|
Using VS2017, writing a MVC5 app...
I added a new controller, and a view to go with it (not using the scaffolding thing, just creating them individually). Something I've done dozens of times.
In the Controllers folder I have this class:
DemosController
And in that class, I have:
public ActionResult DemoTreeView()
{
return View();
} In the Views folder, I have a Demos folder, and in thast folder I have this file:
DemoTreeView.cshtml
When I try to "render in browser", I get a 404 error saying that "mynewcontroller/mynewview" couldn't be found.
What I Tried
0) I verified that the controller and view are named appropriately.
1) I tried deleting the view and recreating it
2) I tried decorating the associated ActionResult method in the controller with HttpGet and AllowAnonymous (neither of which should be necessary).
3) I tried doing the same controller/view creation in a new project (using VS2015), and it works fine (this was just to proved to myself that what I was doing was appropriate).
I'm out of ideas...
EDIT ===================================
Well, I tried it by creating the controller with get/set methods, and it created the views folder for me. When I moved the views to that folder and added the appropriate methods to the controller, it worked.
My (rhetorical) question is why does it matter how I created the folder if all the necessary parts are there?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 12-Apr-19 13:29pm.
|
|
|
|
|
One thing I've seen cause that is if the controller isn't in the correct namespace.
Otherwise, is it failing to find the action, or failing to find the view? If it's the view, then try loading it locally, and it should give you a list of where it looked to try to find the view. If it's the route, then Phil Haack's URL Routing Debugger[^] might help.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I verified that the namespace was correct, that it was inheriting from Controlleer (as opposed to APIController), and that the method names matched the view file names. Everything was aligned, and the 404 error even gave the expected path. I deleted all associated files, and created the controller with insert/edit/delete methods (that I deleted), which created the view subfolder. I re-added my methods and view files, and it worked.
High strangeness...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I am working on a serverless application in Reactjs. I need to implement a scenario to download multiple files in the same folder with the browser.
Currently, I have used the JsZip, But it fails for larger files and crashes the browser.
So, I want an alternative for it. As an alternative, I want to download and save all files into the same directory.
Anyone have any idea. Please share your answers.
Thank in advance.
|
|
|
|
|
Simple question. What is an IPrincipal?
This is a typical MS help page. Technically accurate but practically useless.
A principal object represents the security context of the user on whose behalf the code is running, including that user's identity (IIdentity) and any roles to which they belong.
OK, so what exactly is a Principal? An example would be helpful.
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
|
I googled all weekend, and never stumbled on a way to do these two things:
0) I want to pre-decorate all required fields with a red border (as opposed to an asterisk) when the form loads.
1) I want to validate on the fly, as the user types in the fields, and selects in drop downs.
If anyone can direct me to one or more pages that describes either or both of these things, I'd appreciate it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
good job! I have been looking for this information for a long time 192.168.l.l
|
|
|
|
|
I have the brilliant idea that I want to write a html/js/css webpage from scratch.
My current issue is with bundling, or for development unbundled auto added files.
Is there a way that on the HTML that the script tag for external .js files could be written once?
<script src="scripts/*.js"> </script>
Using VS Code with Live Preview extension.
Are the "best" options going to be use node/php/aspnet?
With asp.net applications I am familiar with and would love something similar like the bundling functionality.
If in debug - then each file of the bundle is included as individual script links, allowing for debugging.
Then switch to prod, and becomes 1 file.
But the bundler also allows for wildcards, making any new files created added into the bundle.
|
|
|
|
|
What about bundling your external JavaScript files into one file, using a bundling tool (like webpack) and, write one script tag for the bundled file?
|
|
|
|
|
|
I know that you experiment with shampoos,conditioners, and other products for hair care to learn how to take care of your hair . what do you experiment with for web design to learn how to build and design beautiful or etc. blogs ?
|
|
|
|
|
Start with defining some minimum parameters that you need. Not "wants" but "needs".
Do you want raw code editing to allow for those little tweaks?
Or if ok limited to GUI edits?
Integration support to other services? Face/Twitter?
Custom Domain options?
...
Form with list and hopfully will help when scanning through a list of top 10 web blogs makers, you can tweak or skip testing a bunch of things.
Keep in mind to separate your Needs and Wants.
|
|
|
|
|
Is it possible to copy values from an Excel column and paste it to a specific column at a specific point in an aspx GridView.
|
|
|
|
|
Assuming you've set the GridView up so that every cell contains a textbox, you can use Javascript to handle the paste:
Copy and paste from excel spreadsheet into HTML table with cloned rows using Javascript? - Stack Overflow[^]
$('<%= YourGridView.ClientID %>').on('paste', 'input', function(e){
var $this = $(this);
$.each(e.originalEvent.clipboardData.items, function(i, v){
if (v.type === 'text/plain'){
v.getAsString(function(text){
var x = $this.closest('td').index(), y = $this.closest('tr').index();
text = text.trim('\r\n');
$.each(text.split('\r\n'), function(i2, v2){
$.each(v2.split('\t'), function(i3, v3){
var row = y + i2, col = x + i3;
$this.closest('table').find('tr:eq('+row+') td:eq('+col+') input').val(v3);
});
});
});
}
});
return false;
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for the assist will check it out.
|
|
|
|
|
I have this method on my controller
[HttpGet]
public Response<List<OperatorEntity>> GetAllChangedOperators(string instrumentName)
{
return GetBL().GetAllChangedOperators(instrumentName);
}
When I call it I get "No action was found on the controller 'Operator' that matches the request."}.
If I remove the parameter then it works fine. if I embed the parameter name inside a class and call it passing the object - that also works.
What's wrong with this??
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
How are you passing the parameter? For a GET request, it should be in the querystring:
https:
NB: You can use a tool like Fiddler[^] to view the details of the request and response.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Does Ejs template only work with get request because as in my code when I'm using it with GET request it is totally working. IF it is yes, then how can I route my ejs page with POST request because when I am using it with POST request it says CANNOT GET error.
|
|
|
|
|
I have an ASP.Net Web API. When I run it locally it works fine. I installed it on a server in IIS.
When I run http://192.168.51.74:8092 I get the file listing, so it looks like it's seeing the site.
When I try to hit a controller, like http://192.168.51.74:8092/api/Operator/GetAllOperators/, I get a not found.
I'm pretty new to this. Anyone know what I'm doing wrong? How do I debug this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Unfortunately, there are about a thousand possible causes for this.
A big one is the configuration of the AppPool that you're using. It should be set for Integrated, 4.0+, and if you compiled your app for "Any CPU" you'll need select advanced settings and set the "Enable Support for 32-bit applications" to true.
Or it might be that the appropriate handlers or modules aren't being loaded. A common work-around for that is to go to the project web.config and add this attribute to the system.webservser.modules attribute runAllManagedModulesForAllRequests="true".
Or something else. I hope you're getting traction on this!
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
I'm working on simple crud in laravel.I already built Controller,form, and model.But everytime i click the submit input.They always return this url and show 404 not found error,instead of insert the data.Can someone help me to find the problem?i have no clue about this part.
http://127.0.0.1:8000/POST?_token=bD5c3O0XpfTX7NWL7RA7wXSw3rWrQ12fbGLMw0kf&kode=galih&nama=galih&submit=Submit[^]
I set the route using Route::resource('urusan','MasterUrusanController)
Insert Form
<form action="POST" action="{{url('urusan')}}">
{{ csrf_field() }}
<table>
<thead>
<tr>
<td>Kode Urusan</td>
<td><input type="text" name="kode"></td>
</tr>
</thead>
<tbody>
<tr>
<td>Nama Urusan</td>
<td><input type="text" name="nama"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" class="btn btn-primary" value="Submit"></td>
</tr>
</tbody>
</table>
</form>
Insert Form
<form action="POST" action="{{route('urusan.update',$urusan->kode_urusan)}}">
{{ method_field("PUT") }}
{{ csrf_field() }}
<thead>
<tr>
<td>Kode Urusan</td>
<td><input type="text" name="kode" value="{{$urusan->kode_urusan}}"></td>
</tr>
</thead>
<tbody>
<tr>
<td>Nama Urusan</td>
<td><input type="text" name="nama" value="{{$urusan->nama_urusan}}"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" class="btn btn-primary" value="Update"></td>
</tr>
</tbody>
</form>
</table>
Controller
class MasterUrusanController extends Controller
{
public function index()
{
$urusan=MasterUrusan::all();
return view('master_urusan.select',['urusan'=>$urusan]);
}
public function create()
{
return view('master_urusan.insert') ;
}
public function store(Request $request)
{
$data=new MasterUrusan();
$data->nama = $request->get('kode');
$data->nama = $request->get('nama');
$data->save();
return redirect('/urusan');
}
public function edit($kode_urusan)
{
$data = MasterUrusan::where('kode_urusan','=',$kode_urusan)->firstOrFail();
return view('master_urusan.update', ['urusan' => $data]);
}
public function update(Request $request,$kode_urusan)
{
$data = MasterUrusan::where('kode_urusan','=',$kode_urusan)->firstOrFail();
$data->nama = $request->get('nama');
$data->save();
return redirect('/urusan');
}
public function destroy($kode_urusan)
{
$data = MasterUrusan::where('kode_urusan','=',$kode_urusan)->firstOrFail();
$data->delete();
return redirect('/urusan');
}
}
modified 12-Mar-19 5:47am.
|
|
|
|
|
Galih indra waspada wrote:
<form action="POST" action="{{url('urusan')}}">
You've specified the action attribute twice. The first one should be method :
<form method="POST" action="{{url('urusan')}}">
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi
I use below command On my app for making a password-protected zip file.
def make_zip_heroku(filename,zip_file_pw):
""" This is just usual zip app that exist on ubuntu/linux/etc """
print("Start make zip archive")
zip_file_pw = "-P "+zip_file_pw
OutPutArchive = str(filename)+".zip"
rc = subprocess.call(['zip', OutPutArchive, filename, zip_file_pw, '-9'])
return OutPutArchive
make_zip_heroku("some_file","123")
after zip file saved.. i use an API and upload file to remote server and access it in my PC
But Problem is :
I can't open file with password "123" that i set.
1- I check checksum of my file when created by server and check it when i download my file on windows..
checksum string is same...
2- My zip file size is 80 MB
3- maybe zip command make archive using ..i dont know what method of archiving that can't be work on windows..
Thanks.
|
|
|
|
|