Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改URL asp.net_Asp.net_Url_Visual Studio 2012 - Fatal编程技术网

更改URL asp.net

更改URL asp.net,asp.net,url,visual-studio-2012,Asp.net,Url,Visual Studio 2012,我正在Visual Studio中使用C#构建一个项目。 当我试图运行该程序时,我得到了错误HTTP404。 我的问题是如何更改我的URL http://localhost:55188/login.aspx?ReturnUrl=%2f 到 页面login.aspx不再存在 这是我的web.config <configuration> <system.web> <compilation debug="true" targetFramework="4.5" />

我正在Visual Studio中使用C#构建一个项目。 当我试图运行该程序时,我得到了错误HTTP404。 我的问题是如何更改我的URL

http://localhost:55188/login.aspx?ReturnUrl=%2f 

页面login.aspx不再存在

这是我的web.config

<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Forms">

  <forms defaultUrl="addRole.aspx" path="/"/>
</authentication>
<authorization>
  <deny users="?"/>
</authorization>
</system.web>  
<location path="LoggedIn.aspx">
<system.web>
  <authorization>
    <allow users="*"/>
  </authorization>
</system.web>
</location>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
</configuration>


谢谢。

您尝试访问的页面需要身份验证,您的web.config说login.aspx可以提供此功能。改变你的web.config,你会没事的

这是您的web.config,不需要身份验证:




当Matthias Aslund正确启动时,您已指定希望对用户进行身份验证,但未指定希望用户重定向到哪个登录页面,以便使用Web.config文件中forms元素上的“LoginUrl”属性登录。因此,将使用“Login.aspx”的默认值,如本节所述。“DefaultUrl”属性有不同的用途,如果没有使用上面URL中可见的“ReturnUrl”查询字符串值指定属性,“DefaultUrl”属性用作登录后将用户重定向到的默认页面-有关详细信息,请参阅

如果您的应用程序中不再有任何身份验证,也就是说,任何用户都可以在不使用用户名和密码的情况下访问您的应用程序,那么您需要如下更改Web.config。非常重要的一点是,您必须清楚,能够访问您的应用程序的任何用户现在都可以访问应用程序的任何部分,并且不存在基于该用户已通过应用程序验证/已知、是特定用户或处于特定角色这一事实的限制

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="None" />
  </system.web>  
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
</configuration>


这将替换上面提供的Web.config文件的全部内容,但您必须清楚,这将从应用程序中删除所有身份验证(这似乎是您想要的)。

我在上面添加了我的Web.config。其中没有login.aspx。login.aspx是的默认loginurl。看见如果你不再需要认证指令,就禁用它。对不起,我不知道该怎么做。你能给我看看吗?
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="None" />
  </system.web>  
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
</configuration>