|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:
And in that class, I have:
public ActionResult DemoTreeView()
Views folder, I have a
Demos folder, and in thast folder I have this file:
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
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...
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.
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.