¡@

Home 

c# Programming Glossary: httpcontext.current.user

Why is an “await Task.Yield()” required for Thread.CurrentPrincipal to flow correctly?

http://stackoverflow.com/questions/16653308/why-is-an-await-task-yield-required-for-thread-currentprincipal-to-flow-corr

2012 .NET 4.5 WebAPI project. I'm trying to assign both HttpContext.Current.User and Thread.CurrentPrincipal in an asynchronous method. The assignment.. Task.Yield var principal new MyPrincipal System.Web.HttpContext.Current.User principal System.Threading.Thread.CurrentPrincipal principal.. ApiController.User returns Thread.CurrentPrincipal . HttpContext.Current.User always flows correctly even without await Task.Yield . Web.config..

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

http://stackoverflow.com/questions/3057937/difference-between-http-context-user-and-thread-currentprincipal-and-when-to-use

the Thread.CurrentPrincipal. In my code I now use... HttpContext.Current.User myCustomPrincipal Thread.CurrentPrincipal myCustomPrincipal.. 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..

Page.User.Identity.IsAuthenticated still true after FormsAuthentication.SignOut()

http://stackoverflow.com/questions/4050925/page-user-identity-isauthenticated-still-true-after-formsauthentication-signout

pulls its value from Context.User which can be modified HttpContext.Current.User.Identity.IsAuthenticated true FormsAuthentication.SignOut HttpContext.Current.User.. true FormsAuthentication.SignOut HttpContext.Current.User new GenericPrincipal new GenericIdentity string.Empty null now.. GenericPrincipal new GenericIdentity string.Empty null now HttpContext.Current.User.Identity.IsAuthenticated false and Page.User.Identity.IsAuthenticated..

Mock HttpContext.Current in Test Init Method

http://stackoverflow.com/questions/4379450/mock-httpcontext-current-in-test-init-method

have no control over which tries to run the following code HttpContext.Current.User.Identity.IsAuthenticated Now you can probably see the problem... new HttpResponse new StringWriter User is logged in HttpContext.Current.User new GenericPrincipal new GenericIdentity username new string.. GenericIdentity username new string 0 User is logged out HttpContext.Current.User new GenericPrincipal new GenericIdentity String.Empty new string..

MVC Custom Authentication, Authorization, and Roles Implementation

http://stackoverflow.com/questions/8567358/mvc-custom-authentication-authorization-and-roles-implementation

private static void BuildUserContext BuildUserContext HttpContext.Current.User private static void BuildUserContext IPrincipal user if user.Identity.IsAuthenticated..

Forms Authentication understanding context.user.identity

http://stackoverflow.com/questions/8810496/forms-authentication-understanding-context-user-identity

if any security information exists for this request if HttpContext.Current.User null see if this user is authenticated any authenticated cookie.. any authenticated cookie ticket exists for this user if HttpContext.Current.User.Identity.IsAuthenticated see if the authentication is done.. the authentication is done using FormsAuthentication if HttpContext.Current.User.Identity is FormsIdentity Get the roles stored for this request..