ASP.NET重定向到默认重定向url以外的页面
在asp.net中,我们在使用表单身份验证时指定重定向url,如下所示:ASP.NET重定向到默认重定向url以外的页面,asp.net,forms-authentication,Asp.net,Forms Authentication,在asp.net中,我们在使用表单身份验证时指定重定向url,如下所示: <authentication mode="Forms"> <forms name="myApp" loginUrl="Login.aspx" protection="All" defaultUrl="default.aspx" path="/" requireSSL="false"/> </authentication> 现在是否可以让用户在登
<authentication mode="Forms">
<forms name="myApp" loginUrl="Login.aspx" protection="All" defaultUrl="default.aspx" path="/" requireSSL="false"/>
</authentication>
现在是否可以让用户在登录前选择要重定向到的页面
例如,用户在登录之前从列表中选择要登录的页面,然后在进行身份验证时重定向到此页面,而不是default.aspx页面
这可能吗?如果可能,如何做到这一点?您可以使用该方法,然后手动重定向:
FormsAuthentication.SetAuthCookie(IDTextBox.Text, RememberCheckBox.Checked);
Response.Redirect("some url the user has choosen");
FormsAuthentication.SetAuthCookie(IDTextBox.Text, RememberCheckBox.Checked);
Response.Redirect("some url the user has choosen");