c# - Where should I be retrieving the user principal in an ASP.NET Web Forms app? -
assuming general use case in asp.net web forms application, should retrieving principal + identity?
i'm aware there 2 ways go it:
httpcontext.current.userthread.currentprincipal
i'm speculating using httpcontext run risk of current context not existing (i.e. httpcontext.current == null) on edge cases, more see code use instead of thread.currentprincipal (which assume safer, should exist?).
why this? implications getting myself if pick 1 or other?
rep whoring here come :)
mr. hanselman has blogged here: http://www.hanselman.com/blog/systemthreadingthreadcurrentprincipalvssystemwebhttpcontextcurrentuserorwhyformsauthenticationcanbesubtle.aspx
the basic idea 99% of time.. same.. although it's possible change them.
Comments
Post a Comment