Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.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
Asp.net 为什么LoginStatus控件不重定向到Web服务器根目录上的登录页面?_Asp.net - Fatal编程技术网

Asp.net 为什么LoginStatus控件不重定向到Web服务器根目录上的登录页面?

Asp.net 为什么LoginStatus控件不重定向到Web服务器根目录上的登录页面?,asp.net,Asp.net,我在IIS 8上用asp.net 4.5编码,有一个母版页,菜单中有一个LoginStatus控件。此控件显示在每页上 <asp:LoginStatus ID="LoginStatus1" runat="server" CssClass="loginbutton" LoginText="Log In" Width="50" LogoutAction="Redirect" LogoutPageUrl="~/Default.aspx" /> 如果有人去http://localhos

我在IIS 8上用asp.net 4.5编码,有一个母版页,菜单中有一个LoginStatus控件。此控件显示在每页上

<asp:LoginStatus ID="LoginStatus1" runat="server" 
CssClass="loginbutton" LoginText="Log In" Width="50" 
LogoutAction="Redirect" LogoutPageUrl="~/Default.aspx" />

如果有人去
http://localhost/
它们被重定向到
http://localhost/Default.aspx
其中loginstatus控件工作正常。仍然不知道问题的原因,但至少我有一个解决办法。

web.config
中指定登录页面

<authentication mode="Forms">
  <forms loginUrl="~/folder/Login.aspx" timeout="2880"/>
</authentication>

不确定是否找到了解决方案。我相信我也有同样的问题。除非url中包含aspx文件,否则该按钮似乎不会回发。e、 g.www.mydomain.com/不起作用,但www.mydomain.com/index.aspx起作用。 我已经用url映射一起破解了一个解决方案

<urlMappings enabled="true">
            <add url="~/" mappedUrl="~/index.aspx" />
    </urlMappings>

这确实有效,但并不十分优雅。 这是在我升级到使用iis 8的新服务器时发生的。 我很想知道你是否找到了更好的解决办法。
谢谢

我已经在我的Web.config中找到了它(没有超时)。我的问题是,这在显示默认文档的页面上不起作用,即,您是否有路由或其他您认为与重定向到登录页面冲突的内容?请尝试测试loginURL使用的方法。例如,在默认页面上创建一个按钮,然后使用
FormsAuthentication.RedirectToLoginPage()方法单击redirect
<urlMappings enabled="true">
            <add url="~/" mappedUrl="~/index.aspx" />
    </urlMappings>