HttpContext.Current.User.Identity.IsAuthenticated is false after Response.Redirect - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

HttpContext.Current.User.Identity.IsAuthenticated is false after Response.Redirect

  • HttpContext.Current.User.Identity.IsAuthenticated is false after Response.Redirect
  • Hi,
    We are working on a solution where we are using custom pages that requires User to be logged in. To test this scenario, we simply created a login page (login.aspx) with ASP.Net Login Control and another page (securepage.aspx) which should show only if the user is logged in.

    Everything works fine till be do a Response.Redirect("securepage.aspx") i.e. HttpContext.Current.User.Identity.IsAuthenticated is true till we call Response.Redirect.

    However, when we check HttpContext.Current.User.Identity.IsAuthenticated on Page_Load of securepage.aspx it is returning false.

    Currently the code is very simple and is as follows:

    //** login.aspx **
    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        UserManager userManager = UserManager.GetManager();
        if (userManager.ValidateUser(Login1.UserName, Login1.Password))
            e.Authenticated = true;
    protected void Login1_LoggedIn(object sender, EventArgs e)

            UserManager userManager = UserManager.GetManager();
        Telerik.Sitefinity.Security.Model.User userToAuthenticate =null;
        UserLoggingReason userLoggingReason = SecurityManager.AuthenticateUser(userManager.Provider.Name, Login1.UserName, Login1.Password, false, out userToAuthenticate);
        //bool isLoggedIn = HttpContext.Current.User.Identity.IsAuthenticated; <---- returns true


    //**securepage.aspx **
    protected void Page_Load(object sender, EventArgs e)
        bool isLoggedIn = HttpContext.Current.User.Identity.IsAuthenticated;  //<--- returns false

    As I read somewhere in the forum that SecurityManager.AuthenticateUser method will automatically set the required cookies etc, which means the above should work, but looks like we are doing something wrong (or something that we are not doing) due to which it is not working.

    Please Help!!

    Santanu Biswas

  • Hello Santanu,

    Can you give us more details on your scenario? Are you using claims based authentication or forms based?

    Jen Peleva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hi Jen,
    By the time your reply came in, we have been able to solve the problem. It was indeed a problem of Authentication type. We could solve it by selecting 'Form Based Authentication' in Sitefinity. By default 'Claim Based Authentication' was selected.
    Thanks for your reply anyways.
  • Hello Jen,

    Can you please explain with a claims based authentication scenario?

    Thanks in advance
  • Hi Jen

    Can I also please put in a call for an explanation/demo code for a claims based authentication scenario as we are having a very similar problem.

    David Bigg