This is a migrated thread and some comments may be shown as answers.

.Net upgrade and Response.Redirect

4 Answers 118 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 07 May 2014, 12:53 PM
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);
 
}

4 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 08 May 2014, 02:29 PM
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.

 
0
Eric
Top achievements
Rank 1
answered on 29 May 2014, 06:02 PM
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.
0
Eric
Top achievements
Rank 1
answered on 29 May 2014, 06:06 PM
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.
0
ChrisS
Top achievements
Rank 1
answered on 01 Jul 2014, 01:12 PM
Hi Erik,

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

Thanks for posting.
Tags
Ajax
Asked by
Eric
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Eric
Top achievements
Rank 1
ChrisS
Top achievements
Rank 1
Share this question
or