我构建了一个托管在ASP.NET Web App上的Silverlight应用程序。 /启用IIS7/SSL的网站。
为了安全起见,我把我的Silverlight页面一个成员文件夹中的ASP.NET Web应用程序,并限制来自匿名用户的访问。(见下面的web.config)ASP.NET登录页面重定向问题
当用户尝试访问成员文件夹下的页面,他们被重定向到https://www.ssldemo.com/authenticationtest/login.aspx。 (请参阅下面的web.config) (我已将www.ssldemo.com映射到127.0.0.1)。 为了安全起见,我在login.aspx中切换到HTTPS,并在验证后返回到HTTP。下面的代码为login.aspx.cs,下面是 。
protected void Page_Load(object sender, EventArgs e)
{
LoginControl.LoggedIn += new EventHandler(LoginControl_LoggedIn);
}
void LoginControl_LoggedIn(object sender, EventArgs e)
{
//for going to ReturnURL & switching back to HTTP
string serverName = HttpUtility.UrlEncode(Request.ServerVariables["SERVER_NAME"]);
string returnURL = Request["ReturnURL"];
Response.Redirect(ResolveClientUrl("http://" + serverName + returnURL));
}
的问题是,当我部署另一应用http://www.ssldemo.com/authenticationtest/members/AnotherApplication/ 和开放http://www.ssldemo.com/authenticationtest/members/AnotherApplication/default.aspx, 用户重定向到https://www.ssldemo.com/authenticationtest/login.aspx?ReturnUrl=%2fauthenticationtest%2fmembers%2fanotherapplication%2fdefault.aspx。 但是即使当我在登录页面输入正确的凭证时,我也会被重定向到,而不是ReturnUrl。当我看着小提琴手时,它说'302物体移到这里了。'
谢谢您的阅读!任何输入将不胜感激。
<configuration>
<connectionStrings>
<add name="CompanyDatabase" connectionString="Data Source=192.168.0.2;Initial Catalog=SomeTable;User ID=Username;[email protected]" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms slidingExpiration="true" timeout="15"
loginUrl="https://www.ssldemo.com/authenticationtest/login.aspx"
defaultUrl="~/Members/Default.aspx"
>
</forms>
</authentication>
<!--Custom Membership Provider-->
<membership defaultProvider="MyMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="MyMembershipProvider"
type="AuthenticationTest.Web.MyMembershipProvider"
connectionStringName="CompanyDatabase"
applicationName="AuthenticationTest.Web"/>
</providers>
</membership>
</system.web>
<!--securing folders-->
<location path="Members">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>