I have this code, when I need to enter the User, this line sUserData is set correctly.
Dim sUserData As String = HttpContext.Current.Request.Cookies("UserID").Value & "|" & HttpContext.Current.Request.Cookies("UserName").Value & "|" & HttpContext.Current.Request.Cookies("UserEmail").Value
Dim fat As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _
HttpContext.Current.Session("UserID"), DateTime.Now, _
DateTime.Now.AddDays(6), True, sUserData, _
FormsAuthentication.FormsCookiePath)
HttpContext.Current.Response.Cookies.Add(New HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(fat)))
Then I have a code where I check if the user is, if he is registered in the Shared (static) method in an open class, like this:
If HttpContext.Current.User.Identity.IsAuthenticated Then
EndIf
And this works fine, but if I put the same line in the Page_load instead of the Shared Method class, it will never go into this If statement
If HttpContext.Current.User.Identity.IsAuthenticated Then
EndIf
, , Page_Load , . , - . " " , , .