c# - Does Forms authentication remember authentication? -
preview: in web.config - don't use forms authentication. set forms cookie myself.
however - see code :
/*1*/ protected void application_authenticaterequest(object sender, eventargs e) /*2*/ { /*3*/ if (httpcontext.current.user != null) /*4*/ { /*5*/ if (httpcontext.current.user.identity.isauthenticated) /*6*/ { /*7*/ //... /*8*/ httpcontext.current.user = .... /*9*/ //... /*10*/ } /*11*/ } /*12*/ }
looking @ line #5
—
how can ever authenticated if line#8 set authentication ?
i mean - line #8 1 set authentication specific request , when request finished , there no "memory" future requests. ( cookie expiration merely - how long keep persistent cookie).
question
- in scenarios line
#5
returntrue
? - in scenarios line
#3
null
?
nb , question assumes begin_request
event not setting , , stage authentication set on application_authenticaterequest
. — don't use membership engine.
placeholder :
http://msdn.microsoft.com/en-us/library/aa289844(v=vs.71).aspx
line #3 can become null if login cookie expires. line #5 true if user logged in.
it can seem these 2 methods go hand-in-hand , in fact do. can easier check httprequest.isauthenticated
. more information see here:
asp.net membership isapproved false still allowing login
and here:
http://msdn.microsoft.com/en-us/library/system.web.httprequest.isauthenticated%28loband%29.aspx
i not have answer main question though. sorry.
in addition comment below may find link helps explain abilities of adding roles existing principles. http://msdn.microsoft.com/en-us/library/vstudio/5k850zwb%28v=vs.100%29.aspx
Comments
Post a Comment