Tutorial :What sets Page.User.Identity.Name



Question:

I keep track of the current logged in userID and base the behavior of my site on this value. My code sets the logged in user ID with this statement:

FormsAuthentication.SetAuthCookie(UserID.ToString(), true);  

Subsequently, I read this value from Page.User.Identity.Name.

This works fine on my desktop, but on my server, I set it to 8 and it comes back 20. I am trying to figure out what can set Page.User.Identity.Name to a value and when this happens.

Thanks...


Solution:1

FormsAuthenticationModule handles Application_OnAuthenticate and assigns the HttpContext.User to a prinicipal object which is in turn used by Page.User.Identity.Name.

Isn't there a time difference issue on the server and your desktop?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »