0
我覺得我通過詢問此問題來擊敗死馬,但我只是不理解重定向...如果用戶嘗試要在不登錄的情況下訪問僅限會員的網頁,如何將該用戶重定向到登錄頁面?在我的搜索中,我已經看到了幾個修改我的web.config文件的參考,但是,沒有什麼能夠成爲讓我工作的關鍵......當我嘗試訪問僅限會員的頁面時未經過身份驗證,我收到了404錯誤。當我通過身份驗證時,頁面加載得很好......我錯過了什麼?嘗試訪問僅限會員的頁面時無法將用戶重定向到登錄頁面
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
<connectionStrings>
<add name="LOTOConnectionString" connectionString="Data Source=WIWRMS-SQLD2\SQLD2;Initial Catalog=LOTO;User ID=LOTO_ADMIN;Password=lotoadmin"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" loginUrl="~/Account/Login" defaultUrl="~/" />
</authentication>
<membership defaultProvider="SqlProvider" >
<providers>
<clear />
<add
name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="LOTOConnectionString"
applicationName="/"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed"/>
</providers>
</membership>
<pages enableEventValidation="false" />
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>