如何从URL中移除RETURNURL? [英] How to remove returnurl from url?

查看:103
本文介绍了如何从URL中移除RETURNURL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要当一个用户想要访问到登录页面需要从地址栏中删除RETURNURL = /布拉布拉。因为我想将用户重定向到一个静态页面登录后做一些选择。

I want to remove "returnurl=/blabla" from address bar when a user want to access to a login required page. Because I'm trying to redirect the user to a static page after login to do some selections.

我怎么能这样做?

推荐答案

这就是性质表单验证即可。 (其中即时通讯您正在使用猜测)。

This is the nature of Forms Authentication. (which im guessing you're using).

也就是说,当您访问需要身份验证的页面时,ASP.NET将您重定向到登录页面,在RETURNURL作为参数传递,所以你可以返回到您登录后附带的网页。

That is, when you access a page which requires authentication, ASP.NET will redirect you to the login page, passing in the ReturnUrl as a parameter so you can be returned to the page you came from post-login.

要删除这个功能将打破语义和窗体身份验证本身的设计。 (IMO)

To remove this functionality would break the semantics and design of Forms Authentication itself. (IMO)

我的建议 - 如果你不需要它,不使用它

My suggestion - if you dont need it, dont use it.

我试图将用户重定向到一个
  登录后静态页面做一些
  选择。

I'm trying to redirect the user to a static page after login to do some selections.

一块蛋糕 - 你做你登录后,而不是做的 FormsAuthentication.RedirectFromLoginPage (它使用非常RETURNURL查询参数),只需使用 FormsAuthentication.SetAuthCookie 和重定向无论你想要的。

Piece of cake - after you've done your login, instead of doing FormsAuthentication.RedirectFromLoginPage (which uses that very ReturnUrl QueryString parameter), just use FormsAuthentication.SetAuthCookie and redirect wherever you want.

这篇关于如何从URL中移除RETURNURL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆