RadAjaxPanel.Redirect Failing to Redirect

2 posts, 0 answers
  1. Adam
    Adam avatar
    1 posts
    Member since:
    Mar 2009

    Posted 23 Nov 2016 Link to this post

    Hello, I have an old project I am upgrading to the most recent Telerik Release and I'm running into issues while redirecting from a login page.

     

    The code is pretty straight forwards,. the Default.aspx page looks something like this:

    protected void Page_Load(object sender, EventArgs e)
            {           
                if (Context.Session != null)
                {
                    if (Session.IsNewSession)
                    {
                        string szCookieHeader = Request.Headers["Cookie"];
                        if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
                        {
                            Response.Redirect("/Login.aspx");
                        }
                    }
                }
                 
                if (!Convert.ToBoolean(Session["UserIsAdmin"]))
                {
                    //Acquire appropriate redirect path from database
                     
                    Response.Redirect(redirectPath);
     
                }
                else
                {
                    Response.Redirect("/Modules/Admin/UserSetup.aspx");
                }           
            }

     

    and the login page has a username and password field with a log in button that looks like so:

     

    protected void bLogin_Click(object sender, EventArgs e)
            {
                try
                {
                    if (allowLogin)
                    {
                        UserClass userAuthenticationClass = new UserClass(eUsername.Text, ePassword.Text);
                        if (userAuthenticationClass.IsValidUser)
                        {
                            string s = FormsAuthentication.DefaultUrl;
                            Session["User"] = userAuthenticationClass;
                            Session["UserID"] = userAuthenticationClass.UserID;
                            Session["Username"] = userAuthenticationClass.Username;
                            Session["UserMasterID"] = userAuthenticationClass.UserMasterID;
                            Session["UserIsAdmin"] = (eUsername.Text.ToUpper() == "ADMINISTRATOR") ? "True" : "False"
                            Session["UserType"] = userAuthenticationClass.UserType;
                            Session["EmailAddress"] = userAuthenticationClass.EmailAddress;
                            Session["SessionID"] = Guid.NewGuid().ToString();
     
                            Session.Timeout = 1440;
     
                            AppCode.SessionStatistics.InsertStatistic(Session["SessionID"].ToString(), Session["UserID"].ToString());
     
                            RadAjaxPanel1.Redirect("/Default.aspx");
                            //FormsAuthentication.RedirectFromLoginPage(eUsername.Text, false);
                            //Response.Redirect("/Default.aspx", false);
                            //Server.Transfer("/Default.aspx", false);
                            //Server.Execute("/Default.aspx", true);
                             
                        }
                        else
                        {
                            LabelMessage.Text = "Could Not Authenticate User";
                        }
                    }
                }
                catch (Exception ex)
                {
                    LabelMessage.Text = ex.Message;
                }           
            }

     

    So Here's where it gets odd. When debugging from Visual Studio, this works correctly. when running on my local web server (set up on my development machine) this also works correctly. but when deployed to a test server, the login button just does not redirect. (it clicks, authenticates the user, then returns to the login page)

     

    I was wondering if it's possible that there is something happening that would cause the Session variables to be lost when using RadAjaxPanel.Redirect?

     

    Keep in mind, this method works perfectly fine on the development environment. Is there anything I need to install/set up on the test environment for this to work?

  2. Patrick
    Admin
    Patrick avatar
    193 posts

    Posted 23 Nov 2016 Link to this post

    Hello Adam,

    This forum post has been converted to a support ticket.  Please see your support tickets for more information.

    Regards,
    Patrick
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top