I have an Area defined in the MVC project named Account and under views in this Area I have Logon.cshtml. In web.config, I got following
<authentication mode="Forms">
<forms loginUrl="~/Areas/Account/LogOn" timeout="600" />
</authentication>
I am using Authorize attribute on my controllers but when I run the project, get following error
Server Error in '/' Application.
The resource cannot开发者_JS百科 be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Areas/Account/LogOn
Any ideas what I am doing wrong?
While the files are stored in a folder named Area
, this does not mean that the routing to this file is /areas/account/logon
.
Review the AccountAreaRegistration.cs
in the Account folder. The AreaName
defined in this file (most likely Account
) is the initial portion of the route to the area. Also, the context.MapRoute
line will have the default Route for your area.
In all likelihood, especially if you did not edit the area registration file, the correct path to put in web.config is ~/account/logon
.
精彩评论