是否有可能从服务器上清除ReturnUrl?我有一个登录页面,用户注销,我想将它们定向到特定的页面,但是当设置ReturnURL时,它会覆盖我的重定向页面。
更新:
理想情况下,无论在特殊情况下,我只会重定向刚刚注销的用户,而不是已标记为或我将重定向的用户。
以下就是这些情况:
时
是否有方法从注销/登录状态控件中移除返回单元?
发布于 2011-01-26 19:38:39
你得稍微调整一下登录逻辑。我从http://digitalcolony.com/2007/05/override-returnurl-in-asp-net-security/那里偷了我的答案。
重写登录逻辑并执行:
if (FormsAuthentication.Authenticate(txtName.Text, txtPassword.Text))
{
FormsAuthentication.SetAuthCookie(txtName.Text, true);
Response.Redirect("MySecuredStartPage.aspx", true);
}发布于 2011-01-26 20:04:40
以下是我的初步解决办法:
发布于 2015-02-11 19:21:54
以下是帮助我的东西:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"])) //check if ReturnUrl is not empty
Response.Redirect("index.aspx"); //redirecting to the page I need
}
}https://stackoverflow.com/questions/4809026
复制相似问题