public static class SessionHandler
{
private static string _userCountryKey = "UserCountry";
public static string UserCountry
{
get
{
/
if (HttpContext.Current.Session[SessionHandler._userCountryKey] == null)
{
return string.Empty;
}
else
{
return HttpContext.Current.Session[SessionHandler._userCountryKey].ToString();
}
}
set
{
HttpContext.Current.Session[SessionHandler._userCountryKey] = value;
}
}
}
here we can set and retrive it ....
SessionHandler.UserCountry="INDIA"
retrive using
Response.Write(SessionHandler.UserCountry);
Avoid all null references that are eating us ......
No comments:
Post a Comment