.Net upgrade and Response.Redirect

5 posts, 0 answers
  1. Eric
    Eric avatar
    5 posts
    Member since:
    Jun 2012

    Posted 07 May 2014 Link to this post

    We are upgrading our code from .Net 3.5 to 4.0 and an issue has come up. The way we previously did login is now having an error on the Response.Redirect. From what have found doing research, it seems to be an error that has something to do with Ajax, adding to the response, and redirect.  Unfortunately I can not find a solution to this problem.

    The error we get is "Uncaught Sys.WebForms.PageRequestManagerParserErrorException" via the javascript from Telerik.Web.UI.WebResource.axd.

    The code snippets we have below work under .Net 3.5 but do not work after attempting the 4.0 upgrade. The authentication cookies do get added as I can manually type the url that we are supposed to redirect to. However, the automatic redirect does not work. 



    <%@ Page Language="C#" MasterPageFile="~/masterpages/WebMain.master" AutoEventWireup="true" Inherits="Default" Codebehind="Default.aspx.cs"%>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMaster" Runat="Server">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="Login">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="Login" LoadingPanelID="AjaxLoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" />   
        <div id="divLogin" runat="server">
            <table align="center">
                <tr>
                    <td align="center">
                        <asp:Login ID="Login" runat="server"
                            OnAuthenticate="Login_Authenticate" DisplayRememberMe="False"
                            Orientation="Horizontal" TextLayout="TextOnTop" TitleText="" LoginButtonStyle-Height="25px" LoginButtonStyle-Width="50px">
                        </asp:Login>
                    </td>
                </tr>
            </table>
        </div>
    </asp:Content>
    protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
    {
        ...
         Response.Cookies.Add(authCookie);
     
         ...
         Response.Redirect(pageUrl, false);
     
    }

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 May 2014 Link to this post

    Hi Eric,

    Please revise the answer provided in the support ticket opened for the same issue. Test the proposed solutions and verify if they help.

    Regards,
    Maria Ilieva
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eric
    Eric avatar
    5 posts
    Member since:
    Jun 2012

    Posted 29 May 2014 Link to this post

    The solution I found was that this issue only appears when debugging so it was not a real issue. The double call only happens when a break point is placed that gets hit allowing the javascript to complete before the code behind.

    So while debugging it appears to be an issue but when not debugging the issue does not appear.
  5. Eric
    Eric avatar
    5 posts
    Member since:
    Jun 2012

    Posted 29 May 2014 in reply to Eric Link to this post

    I'm tired so I posted the solution I had to another issue sorry. The solution was to use RadAjaxManager.Redirect() instead of the Response.Redirect(). Ignore my last post.
  6. ChrisS
    ChrisS avatar
    50 posts
    Member since:
    Aug 2005

    Posted 01 Jul 2014 in reply to Eric Link to this post

    Hi Erik,

    I had the same problem and your solution worked for me. 

    Thanks for posting.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017