1
我試圖在IIS 7中設置表單身份驗證。當用戶試圖擊中網站上的任何網址,他們被重定向到登錄頁面,但他們登錄後,他們不會離開這一頁。如果我啓用匿名日誌記錄,然後登錄頁面正常工作,頁面被重定向到目標頁面。
這裏的web.config文件:在http://technet.microsoft.com/en-us/library/cc753252(v=ws.10).aspx和http://www.iis.net/learn/application-frameworks/building-and-running-aspnet-applications/using-aspnet-forms-authenticationC#.NET登錄不重定向
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="LandingPage" value="/home/default.htm" />
</appSettings>
<system.web>
<compilation debug="false" />
<authentication mode="Forms">
<forms loginUrl="/login/login.aspx" timeout="60" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
<system.webServer>
<httpErrors errorMode="DetailedLocalOnly">
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" prefixLanguageFilePath="" path="/login/login.aspx" responseMode="ExecuteURL" />
</httpErrors>
<defaultDocument enabled="false">
<files>
<remove value="iisstart.htm" />
<remove value="index.htm" />
<remove value="Default.htm" />
<remove value="Default.asp" />
<remove value="default.aspx" />
</files>
</defaultDocument>
<directoryBrowse enabled="false" />
<modules>
<remove name="FormsAuthentication" />
<remove name="DefaultAuthentication" />
<add name="DefaultAuthentication" type="System.Web.Security.DefaultAuthenticationModule" preCondition="" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" preCondition="" />
</modules>
</system.webServer>
</configuration>
我跟着指示,但我一定是錯過了一些東西。
謝謝。
編輯: 添加了建議的元素,但同樣的事情發生。菲德勒表明這一點:
1 302 HTTP localhost / 148 iexplore:14040
2 200 HTTP localhost /login/login.aspx?ReturnUrl=%2f 4,896 private text/html; charset=utf-8 iexplore:14040
3 304 HTTP localhost /images/newheader.jpg 0 iexplore:14040
4 302 HTTP localhost /login/login.aspx?ReturnUrl=%2f 142 private, no-cache="Set-Cookie" text/html; charset=utf-8 iexplore:14040
5 302 HTTP localhost /home/default.htm 170 iexplore:14040
6 200 HTTP localhost /login/login.aspx?ReturnUrl=%2fhome%2fdefault.htm 4,918 private text/html; charset=utf-8 iexplore:14040
7 304 HTTP localhost /images/newheader.jpg 0 iexplore:14040
這是失蹤,但我也需要告訴它檢查所有頁面,而不僅僅是.aspx頁面。一旦我做出了改變並添加了允許用戶開始工作。謝謝! – Striker 2013-05-20 01:48:16