Can't i set Session in a class file?
Posted
by uzay95
on Stack Overflow
See other posts from Stack Overflow
or by uzay95
Published on 2010-04-27T18:36:04Z
Indexed on
2010/04/27
18:43 UTC
Read the original article
Hit count: 293
Why session is null in this even if i set:
public class HelperClass
{
public AtuhenticatedUser f_IsAuthenticated(bool _bRedirect)
{
HttpContext.Current.Session["yk"] = DAO.context.GetById<AtuhenticatedUser>(1);
if (HttpContext.Current.Session["yk"] == null)
{
if (_bRedirect)
{
HttpContext.Current.Response.Redirect(ConfigurationManager.AppSettings["loginPage"] + "?msg=You have to login.");
}
return null;
}
return (AtuhenticatedUser)HttpContext.Current.Session["yk"];
}
}
© Stack Overflow or respective owner