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