3
我正在使用ASP.NET Login Controls和Forms Authentication作为ASP.NET Web应用程序的成员资格/凭据。它保持重定向到我的应用程序根目录中的Login.aspx页面,该页面不存在。我的登录页面位于一个文件夹内。当我的Login.aspx不在我的应用程序的根目录下时,如何使用ASP.NET登录控件?
我正在使用ASP.NET Login Controls和Forms Authentication作为ASP.NET Web应用程序的成员资格/凭据。它保持重定向到我的应用程序根目录中的Login.aspx页面,该页面不存在。我的登录页面位于一个文件夹内。当我的Login.aspx不在我的应用程序的根目录下时,如何使用ASP.NET登录控件?
使用表单项的LoginUrl属性?
<authentication mode="Forms">
<forms defaultUrl="~/Default.aspx" loginUrl="~/login.aspx" timeout="1440" ></forms>
</authentication>
我在CoderSource.net找到答案。我不得不把正确的路径放到我的web.config文件中。
<?xml version="1.0"?>
<configuration>
<system.web>
...
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="~/FolderName/Login.aspx" />
</authentication>
...
</system.web>
...
</configuration>
什么我在位数的 - 是为什么会发生这种情况摆在首位? – Vidar 2008-10-09 09:20:47
我想默认情况下,微软认为你的根目录下有一个Login.aspx页面:http://domain.com/Login.aspx。您必须更改web.config以覆盖该默认假设。 – 2008-10-09 18:32:10