Is it safe to use a Shared property for authentication verification?

WaRPT

New Member
Should I be using \[code\]Shared\[/code\], or just a \[code\]Public\[/code\] function and initiate a class when needed? I have read a number of articles, but still cant get my head around the best option here. Here is the code I want to get. The \[code\]userid\[/code\] in question is a string that's set when the user logs in. As I may need the userid in a number of pages, I want to add it in a class.\[code\]Public Shared ReadOnly Property userid As String Get Dim ck As HttpCookie = HttpContext.Current.Request.Cookies(FormsAuthentication.FormsCookieName) Dim tkt As FormsAuthenticationTicket = FormsAuthentication.Decrypt(ck.Value) Return tkt.Name End GetEnd Property\[/code\]
 
Back
Top