This is unlikely to be a problem, but you might consider storing page-specific values ββin the ViewState.
I create a static SessionInfo class that transfers access to session variables, for example:
public static class SessionInfo
{
private const string AUDITOR_ID_KEY = "AUDITOR_ID_KEY";
private static T GetSessionObject<T>(string key)
{
object obj = HttpContext.Current.Session[key];
if (obj == null)
{
return default(T);
}
return (T)obj;
}
private static void SetSessionObject<T>(string key, T value)
{
if (Equals(value, default(T)))
{
HttpContext.Current.Session.Remove(key);
}
else
{
HttpContext.Current.Session[key] = value;
}
}
public static int AuditorId
{
get { return GetSessionObject<int>(AUDITOR_ID_KEY); }
set { SetSessionObject<int>(AUDITOR_ID_KEY, value); }
}
}
source
share