开发者

Thread.CurrentPrincipal.Identity vs HttpContext.User.Identity [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

difference between http.context.user and thread.currentprincipal and when to use them?

What's the difference between these two in an ASP.NET application?

I know the HttpContext.User.Identity is set when the user is authenticated through FormsAuthentication. But when is the Thread.CurrentPr开发者_开发技巧incipal.Identity set?

Do they always hold the same value?

Does that still hold true for other layers of the application that do not have access to a HttpContext?


HttpContext.User.Identity is the current logged in user in your web app.

Thread.CurrentPrincipal applies only when the <authentication mode = "windows"/>. Normally this is using with Windows based applications (Winforms,WPF..)


if you use the HttpContext.User.Identity equals the Thread.CurrentPrincipal

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜