从 ReturnUrl 访问其他查询字符串键
我需要从 ReturnUrl 查询字符串访问其他查询字符串参数。
整个站点都需要身份验证,因此如果用户未登录或超时,所有页面都将重定向到登录页面。 因此 www.mysite.com/Default.aspx?id=H1234
将重定向到 www.mysite.com/login.aspx?ReturnUrl=%2fDefault.aspx%3fid%3dH1234
如果用户输入凭据,他们将返回到 Default.aspx
并传递 id,但我还需要检查登录页面上的 id。
在登录页面上,我可以 Server.UrlDecode(Request.RawUrl
) 到: /login.aspx?ReturnUrl=/Default.aspx?id=H1234
但因为这有 2问号 我现在无法访问 Request.QueryString("id")
我可以使用子字符串方法来提取值,但这让我担心,因为 id 不是固定长度,而且看起来不安全< /em>.
谷歌上似乎没有太多(或者至少我没有问正确的问题)
I need to access additional querystring parameters from the ReturnUrl querystring.
The entire site requires authentication so all pages will redirect to the login page if the user is not logged in or has timed out. So www.mysite.com/Default.aspx?id=H1234
will redirct to www.mysite.com/login.aspx?ReturnUrl=%2fDefault.aspx%3fid%3dH1234
and if the user then enters their credentials they will be returned to Default.aspx
passing the id, but I need to check the id on the login page as well.
On the login page I can Server.UrlDecode(Request.RawUrl
) to: /login.aspx?ReturnUrl=/Default.aspx?id=H1234
but as this has 2 question marks I now cannot access Request.QueryString("id")
I could use substring methods to extract the value but that worries me as the id is not a fixed length and it seems insecure.
There doesn't seem to be much on Google (or at least I'm not asking the right question)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有答案吗?
这就是我设法整理的:
和
No answers?
This is what I've managed to put together:
and