I have the following code:
if (HttpContext.Current.Request.IsAuthenticated == false) { // this isn't reached so i know user is Authenticated return; } FormsIdentity fIdentity = HttpContext.Current.User.Identity as FormsIdentity; string[] delimitedUserData = fIdentity.Ticket.UserData.Split('|'); // but at this point delimitedUserData.Length is 0
Any ideas on what might make the authentication ticket valid but UserData is gone?
My program works fine, and all UserData are easily accessible. But every time after a while I fall into this state where UserData does not exist.
The ticket is stored in a cookie. What happens in your code when you access the page immediately after the expiration of the cookie?
Also note that User.Identity.IsAuthenticatedreturns true from the field, so the property may not be the best, what can I check for?
User.Identity.IsAuthenticated
FormsAuthentication UserData. , ( UserData) , .
, , . , cookie, cookie .
Firefox, " N ": https://addons.mozilla.org/en-US/firefox/addon/573
, , asp.net, , , - , - cookie , , .
, ( _LoggedIn) :
// write ClientID to the session Session.Add("ClientID", lClientID);
:
if (User.Identity.IsAuthenticated == false || Convert.ToInt32(Session["ClientID"]) == 0) { Server.Transfer("Login.aspx"); }
.
, "FormsAuthentication.RedirectFromLoginPage" cookie. "response.cookies.add". .
Source: https://habr.com/ru/post/1703612/More articles:boost :: thread: Segfault when launching the optimized version - multithreadingHow to create an installation and deployment project that can run any number of times on a machine without the need for removal? - installationare there any ASP.NET with voice recording code examples? - flashFocus control in ListView - androidhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1703611/can-i-limit-users-to-a-specific-range-and-zoom-level-on-google-maps&usg=ALkJrhjfm4N0MnO2OCIMDKZZIHNndFiRaALack of Libtool, double building? - autotoolsCPython internal structures - pythonCamel SOAP Method Names - soapRetrieving username from OpenID - authenticationWhat is a throw - c #All Articles