J
Jane-Wolf
Hi, I have this function and use it for get id of my user company:
public string get_company_from_cookie()
{
string cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie =
Context.Request.Cookies[cookieName];
if (null == authCookie) { }
FormsAuthenticationTicket authTicket = null;
try
{
authTicket =
FormsAuthentication.Decrypt(authCookie.Value);
}
catch (Exception ex)
{
string r = ex.ToString();
Err_Label.Text = "The problem is : ex.ToString()";
}
if (null == authTicket)
{
}
string[] userdatax = authTicket.UserData.Split(new char[] {
',' });
string company_number = userdatax[0];
return company_number;
}
I Use it in all pages, can I describe this function in separate class
and then use in all pages?
public string get_company_from_cookie()
{
string cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie =
Context.Request.Cookies[cookieName];
if (null == authCookie) { }
FormsAuthenticationTicket authTicket = null;
try
{
authTicket =
FormsAuthentication.Decrypt(authCookie.Value);
}
catch (Exception ex)
{
string r = ex.ToString();
Err_Label.Text = "The problem is : ex.ToString()";
}
if (null == authTicket)
{
}
string[] userdatax = authTicket.UserData.Split(new char[] {
',' });
string company_number = userdatax[0];
return company_number;
}
I Use it in all pages, can I describe this function in separate class
and then use in all pages?