欢乐城主管q44144,五道口工人俱乐部,服从之魔环
第一种:同主域但不同子域之间实现单点登陆
form验证其实是基于身份cookie的验证。客户登陆后,生成一个包含用户身份信息(包含一个ticket)的cookie,这个cookie的名字就是在web.config里authentication节form设定的name信息,如
代码实现:
string userdata = jsonhelper.scriptserialize(user); formsauthenticationticket ticket = new formsauthenticationticket(1, user.userid.tostring(), datetime.now, datetime.now.addhours(4), false, userdata); httpcookie cookie = new httpcookie(formsauthentication.formscookiename, formsauthentication.encrypt(ticket));//加密身份信息,保存至cookie cookie.domain = ".zuowenjun.cn"; response.cookies.add(cookie);
第二种:虚拟目录的主应用和子应用之间实现sso
主要是采用页面url传参并重定向来实现,这类实现的方法有很多,但可能需要注意的是安全性问题。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Net Core Web Api项目与在NginX下发布的方法
asp.net core3.1 引用的元包dll版本兼容性问题解决方案
IdentityServer4实现.Net Core API接口权限认证(快速入门)
ASP.NET Core MVC通过IViewLocationExpander扩展视图搜索路径的实现
网友评论