Application control is redirecting to the login page on every serverrequest

Discussion in 'ASP .Net' started by Anup Daware, May 13, 2008.

  1. Anup Daware

    Anup Daware Guest

    Hi All,
    I am facing this very weird issue, for every server request my control
    is redirecting to the login page and again coming back to the actual
    page from where the request was initiated when I set my custom
    Remember be cookie on the login page. Following are the details:
    1. Authentication mode is ‘Forms’
    2. This issue is reproducible only in deployed applications, I found
    this using my trace and remote debugging
    3. This issue occurs only when user selects the ‘Remember Me’ option
    at the time of login, then I set the custom cookie for storing the
    user info. (inbuilt Remember Me of login control is not used as I need
    the fixed expiration and not the sliding one)
    4. It is also observed that issue occurs only when I create a msi and
    deploy it, if I just take the code and publish it on server the
    application works fine and there are no unnecessary redirections to
    login
    5. Application is Ajax enabled


    //Following is the code used for setting the cookie:
    if (Request.Cookies.Get("UserCookie") != null)
    {
    HttpCookie decodedCookie =
    Utilities.HttpSecureCookie.Decode(Request.Cookies.Get("TyreLinkCookie"));
    if (decodedCookie.Values["LanguageCodeForMegaFleet"] != null &&
    decodedCookie.Values["UICulture"] != null &&
    decodedCookie.Values["Culture"] != null &&
    decodedCookie.Values["ClientOffsetTime"] != null)
    {
    currentSessionInfo.LanguageCodeForMegaFleet =
    decodedCookie.Values["LanguageCodeForMegaFleet"].ToString();
    currentSessionInfo.SessionUICulture =
    decodedCookie.Values["UICulture"].ToString();
    currentSessionInfo.SessionCulture =
    decodedCookie.Values["Culture"].ToString();
    currentSessionInfo.LanguageForTyreDetails =
    decodedCookie.Values["LanguageForTyreDetails"].ToString();
    offset =
    double.Parse(decodedCookie.Values["ClientOffsetTime"].ToString());
    }
    }

    //Following the is the code that reads the cookie at the time of load
    of login page:
    if (Request.Cookies.Get("UserCookie") != null)
    {
    HttpCookie cookie = Request.Cookies.Get("UserCookie");
    HttpCookie decodedCookie = Utilities.HttpSecureCookie.Decode(cookie);
    if (decodedCookie.Values["Username"] != null &&
    decodedCookie.Values["Password"] != null)
    {
    if (ValidateUser(decodedCookie.Values["Username"].ToString(),
    decodedCookie.Values["Password"].ToString(),0.0))
    {
    FormsAuthentication.SetAuthCookie(decodedCookie.Values["Username"].ToString(),
    false);
    Response.Redirect(LoginControl.DestinationPageUrl);
    }
    }
    }

    While I am probably almost certain that the issue is with Forms
    Authentication and Cookies, I am not able figure out what it could
    be. Please help.
    Thanks,
    Anup
     
    Anup Daware, May 13, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MattB
    Replies:
    1
    Views:
    527
    Saravana
    Jan 6, 2005
  2. ThePurpleCat

    Login Control Redirecting to Default.aspx

    ThePurpleCat, Sep 27, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,610
    ThePurpleCat
    Sep 27, 2006
  3. =?Utf-8?B?SXJ3YW5zeWFo?=
    Replies:
    4
    Views:
    2,501
    =?Utf-8?B?SXJ3YW5zeWFo?=
    Oct 30, 2007
  4. WhiskyRomeo

    redirecting from another page besides the login page

    WhiskyRomeo, Jan 18, 2005, in forum: ASP .Net Security
    Replies:
    1
    Views:
    132
    WhiskyRomeo
    Jan 18, 2005
  5. Replies:
    1
    Views:
    154
    ccc31807
    Mar 24, 2008
Loading...

Share This Page