社区
IIS
帖子详情
page.user.identity.isauthenticated经常会出现等于false
cong1212
2012-08-09 07:01:26
我的网站使用了from验证,当登陆后有时会出现page.user.identity.isauthenticated等于false问题.而且使用session方式验证也一样不会丢失,我估算是IIS使我from验证里的cookies丢失了,请教一下各位大侠,是什么问题,请各位高手来指点
...全文
143
1
打赏
收藏
page.user.identity.isauthenticated经常会出现等于false
我的网站使用了from验证,当登陆后有时会出现page.user.identity.isauthenticated等于false问题.而且使用session方式验证也一样不会丢失,我估算是IIS使我from验证里的cookies丢失了,请教一下各位大侠,是什么问题,请各位高手来指点
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
孟子E章
2012-08-09
打赏
举报
回复
cookies一般是不会丢失的,注意几个问题:
不能跨域,设置Path=/
解决
User
.
Iden
ti
ty
.
IsAu
then
ti
cat
ed
==
false
或
User
.
Iden
ti
ty
.Name==string.empty的问题
HttpContext.Current.
User
.
Iden
ti
ty
.
IsAu
then
ti
cat
ed
=
false
; HttpContext.Current.
User
.
Iden
ti
ty
.Name=="" 解释:当用户登录时,服务器为确认客户端通过验证要通过cookie向客户端写验证(Authen
ti
cat
)信息,在登录...
解决
User
.
Iden
ti
ty
.
IsAu
then
ti
cat
ed
=
false
或
User
.
Iden
ti
ty
.Name=string.empty的问题
Response.Write(HttpContext.Current.
User
.
Iden
ti
ty
.Name); 执行 Response.Write(HttpContext.Current.
User
.
Iden
ti
ty
.Name);得到是空值。 这时我真的不明白。 后来发现原来 Response.Cookies.Add...
ASP.NET中Request.
IsAu
then
ti
cat
ed
和Request.
User
.
Iden
ti
ty
.
IsAu
then
ti
cat
ed
的区别
Reflector 查看 System.Web.dll 中 HttpRequest.cs 的代码: public bool
IsAu
then
ti
cat
ed
{ get { return (((this._context.
User
!= null) &... (this._context.
User
.
Iden
ti
ty
!= null)) &am...
使用HttpContext的
User
属性来实现用户身份验证
这个示例主要是讲如何使用HttpContext类中的
User
属性来实现用户验证! 用户验证是大部分ASP.NET WEB应用程序都要用到的,它在整个应用程序中占有很重要的地位,在.NET中,包含了很多种用户验证方式,如众所周知的...
使用JWT的ASP.NET CORE令牌身份验证和授权(无Cookie)——第2部分
var
IsAu
then
ti
cat
ed
= context.HttpContext.
User
.
Iden
ti
ty
.
IsAu
then
ti
cat
ed
; var claimsInden
ti
ty = context.HttpContext.
User
.
Iden
ti
ty
as Claims
Iden
ti
ty
; if (
IsAu
then
ti
cat
ed
) { bool flagClaim =
false
;...
IIS
8,327
社区成员
16,639
社区内容
发帖
与我相关
我的任务
IIS
Web 开发 IIS
复制链接
扫一扫
分享
社区描述
Web 开发 IIS
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章