Variables Expired before Asp.net Membership provider automatically logout
I have a microsoft membership provider. in my application I'm using the variable which saving in cookie (tried session). The problem what I have: my variable expired before a authentication automatically log开发者_StackOverflow社区out.
How can I set the time of membership provider automatic logout and expiring variable after the same time, 30 mins for example.
Or how can I create a new server variable?
Or maybe you suggest me better approach?
Thank you
Attempting to manage user data in the manner you state is a sure-fire path to hair pulling and teeth gnashing.
There are more dragons than you suspect and have described.
Consider: The forms ticket expiration is pushed forward on a sliding scale on each request. In order to correlate a foreign cookie to have the same lifespan you would have to duplicate this logic, which resides in the FormsAuthenticationModule
, drastically and unnecessarily complicating your code.
If the data is of reasonable size, simply stuff it into the userData
field of the forms ticket, now your user variable goes wherever the forms ticket codes and is discarded when the forms ticket (or cookie) is expired.
No fuss no muss.
See more details here
精彩评论