如何将登录令牌自动添加到asp.net网站中的所有URL [英] How to automatically add login token to all url in an asp.net web site

查看:113
本文介绍了如何将登录令牌自动添加到asp.net网站中的所有URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET网站.最近,我修改了该站点以在用户登录该站点时生成一个随机令牌,以避免在同一台客户端计算机上重复登录.接下来的事情是在用户登录后将生成的令牌添加到url的查询字符串中,并让该令牌在用户注销之前始终与url一起使用.然后麻烦就来了-有很多方法可以从页面跳到另一页面-Response.Redirect,Server.Transer,< a href ="..."/>,LinkBut​​ton.PostBackUrl,HyperLink.NavigateUrl,( javascrit)window.location等,其中许多已在我的网站中使用.手动将令牌添加到所有令牌中,这令人难以置信.有什么方法可以自动实现这一点-例如isapi过滤器,httpmodule,客户端脚本等等?

I have an ASP.NET web site. Recently I modified th site to generate a random token when a user login into the site to avoid duplicate login on the same client computer. The next thing is adding the generated token to the query string of the url after a user logs in, and let the token always go with the url before the user logs out. Then the trouble comes - there are so many ways to jump from a page to another page - Response.Redirect, Server.Transer, <a href="..." />, LinkButton.PostBackUrl, HyperLink.NavigateUrl, (javascrit)window.location, etc, many of which have been used in my site. It would be unbelievable to manually add the token to all of them. Is there any way to automatically achieve this - like isapi filter, httpmodule, client script, and so on?

Thanks for your help in advance!

推荐答案

尝试使用url中的所有令牌,并使用url地址将它们分开.标志
例如,如果我想在url中传递用户名,那么我在项目中尝试了以下方法
http://www.mypro.com//welcomepage.aspx?info

或者,更好的方法是在调用模块中创建一个公共变量,然后在要导航的另一页中更新它们,并在下一个导航页中使用它们.
Try use all you token in url separate them with url address by using ? sign
such like if i want to pass the username in url then i tried following method in my project
http://www.mypro.com//welcomepage.aspx?info

Or Better way you create one public variable in call module and update them in some another page from where you want to navigate and use them in your next navigation page.


这篇关于如何将登录令牌自动添加到asp.net网站中的所有URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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