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

后端 未结 3 1863
别那么骄傲
别那么骄傲 2020-12-01 21:03

I have just recently run into an issue running an asp.net web app under visual studio 2008. I get the error \'type is not resolved for member...customUserPrincipal\'. Trac

3条回答
  •  日久生厌
    2020-12-01 21:22

    Under a webforms application I believe Thread.CurrentPrincipal will be the principal for whomever is running the worker process (Thread).

    HttpContext.Current.User will be the current logged in web-user.

    In the case of a forms/wpf app it makes sense because the user you're running the application under is the one you're interested in.

    Are you trying to masquerade the worker process or the logged in user?

提交回复
热议问题