[英]The resource cannot be found. Requested URL: /login.aspx
I created a new project Asp.net MVC 4 and when I run that occurs error like: 我创建了一个新项目Asp.net MVC 4,当我运行该项目时,发生如下错误:
The resource cannot 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. 描述 :HTTP404。您正在寻找的资源(或其依赖项之一)可能已被删除,名称更改或暂时不可用。 Please review the following URL and make sure that it is spelled correctly.
请查看以下网址,并确保其拼写正确。
Requested URL: /login.aspx 要求的网址:/login.aspx
I was trying to solve by adding in web.config inside section appSettings a 我试图通过在appSettings部分中添加web.config来解决
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false"/>
but it doesn't work. 但这不起作用。
Next I was trying to set in properties of the project in web section a Project Url but also it doesn't work. 接下来,我试图在Web区域的Project Url中设置项目的属性,但是它也不起作用。
Can anyone help me with it ? 有人可以帮我吗?
Ps. 附言 I think it may be problem with IIS and permission.
我认为IIS和权限可能有问题。
* Login.aspx页面是否与文件位于同一目录中,您试图从该页面重定向到该页面吗?如果该页面位于根目录中,则U不会尝试执行~/Login.aspx
之类的操作?
The following worked for me. 以下对我有用。
Try not only adding this: 尝试不仅添加以下内容:
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false"/>
But also, change web.config in the system.web section: 但是,还要在system.web部分中更改web.config :
<authentication mode="Forms" />
To this: 对此:
<authentication mode="Forms" >
<forms loginUrl="~/Account/Login" name=".ASPXFORMSAUTH"></forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.