使用HttpContext.User.Identity时出现Null错误 [英] Null Error while using HttpContext.User.Identity

查看:77
本文介绍了使用HttpContext.User.Identity时出现Null错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在Global.asax Application_request函数中使用HttpContext.User.Identity.但是,我收到空错误,如何将其删除.

谢谢.

Hi ,

I am using HttpContext.User.Identity in Global.asax Application_request Function.But, I am getting null error how can it be removed.

Thanks.

推荐答案

检查:
if ((User != null) && (User.Identity != null))
    {
    ...
    }

除此之外,我们将需要适当的代码片段才能提供更多帮助.

Other than that, we would need appropriate code fragments before we can help any more.


^ ]线程应该可以为您提供帮助.
This[^] thread should help you.


这篇关于使用HttpContext.User.Identity时出现Null错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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