Reputation: 1461
I've inherited an ASP.NET MVC 3 application. I know NOTHING about MVC 3. I've been using ASP.NET Web Forms though for 5+ years. When I attempt to launch the application from Visual Studio, I receive a 404. The browser points to http://localhost/Account/Logon. I've noticed that in my project, there is:
I am assuming this is what should be launched.I've set a breakpoint in the Global.asax.cs and found that I am being redirected to this page via the following event:
void WSFederationAuthenticationModule_AuthorizationFailed(object sender, AuthorizationFailedEventArgs e)
{
e.RedirectToIdentityProvider = false;
HttpContext.Response.Redirect("/Account/Logon");
}
When I launch the application, I get a 404. I'm completely lost in regards to how to resolve this. I also don't know how to "Set as Start Page" in the MVC world. Can somebody please help me get over this hurdle? I just want to run the application. Thank you so VERY VERY much!
Upvotes: 0
Views: 1908
Reputation: 60468
If you call
MVC, if you changed no routes in global.asax, is looking for
a Controller Named "Account"
the method "LogOn" in this Controller.
If you ActionMethod "Account.LogOn" returns a View, MVC looks into the Views/Account/ Directory and try to find you LogOn View.
Lots of more informations:
Hope this helps
Upvotes: 2
Reputation: 1038720
I am assuming this is what should be launched
No, your assumption is wrong. In ASP.NET MVC you never access view directly. You always pass through a controller action which performs some processing on the model and returns a view.
So when you request /Account/Logon
(assuming default routing) it is the Logon
action on the AccountController
that should be executed:
public class AccountController: Controller
{
public ActionResult Logon()
{
...
}
}
If such action or controller doesn't exist in the project you would get 404.
Before proceeding any further with the inherited project I would very strongly recommend you familiarizing yourself with the basics of ASP.NET MVC by following some of the tutorials here: http://asp.net/mvc
Upvotes: 1