Home » Microsoft Technologies

Response.Redirect problem in Google Chrome

I'm building an ASP.NET 3.5 webapplication using VB.NET, and I'm having problems redirecting to another URL when using Google Chrome. Other browsers like IE and Firefox are fine.

My data entry forms all have an OK and an Cancel button, which are both handled server-side. The Cancel button just redirects back to the originating page, while the OK button will add or update a database record and then redirect to the originating page.
The redirect to the originating page is done by calling the following shared sub on a general utilities class in my appication:

    Shared Sub Redirect(ByVal p_sURL As String)
        Dim l_sURL As String = p_sURL.ToLower
        If Left(l_sURL, 1) = "~" Then
            Dim l_oControl As New System.Web.UI.Control
            l_sURL = l_oControl.ResolveUrl(l_sURL)
        End If
        If Left(l_sURL, 1) <> "/" Then
            If Left(l_sURL, 7) <> "http://" AndAlso Left(l_sURL, 8) <> "https://" Then
                l_sURL = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) & wsUtils.SiteRoot & l_sURL
            End If
        End If
        'HttpContext.Current.Response.Redirect(l_sURL, False)
    End Sub

As you can see, I've tried using the extra argument in the Response.Redirect call, but that doesn't make a difference.

All browsers except Google Chrome redirect fine, but Chrome does not redirect at all. When pushing the Cancel button nothing seems to happen. And when pushing the OK button, the corresponding database record is added or updated, but the redirect to the originating page doesn't happen.

This Chrome redirect problem occurs only on the production server. When running the application at 'localhost' there is no problem.

Any idea what might be causing this redirect issue in Google Chrome?


9 Answers Found


Answer 1

Chrome sucks...It caches 301 redirects

Refer this for more info : http://bugsquash.blogspot.com/2008/12/google-chrome-caches-301-redirects.html

Hope that helps Cool


Answer 2

Ya its true, Chrome caches 301 redirects, so Clearing cache might solve the problem.

Better to write and call  javascript function that contains

{ window.location.href = "RedirPageUrl"; }


Answer 3


Ya its true, Chrome caches 301 redirects, so Clearing cache might solve the problem.

Better to write and call  javascript function that contains

{ window.location.href = "RedirPageUrl"; }

How would I trigger such a JavaScript function when the OK button  on an entry  form is clicked?

I can't put a client-side onClick handler on that button to trigger a client-side redirect, as I need the server-side  code to run first. And the redirect  should then only happen  when the server-side page  validation is done and the database  record was successfully added  or updated.


Answer 4

you can do like this..

protected void button_Click(object sender, EventArgs e)
            // Your Code Here //
            string  RedirPageUrl = "url";
            ClientScript.RegisterClientScriptBlock(this.GetType(), "someKeyRedir", "window.location.href = '" + RedirPageUrl + "';", true);


Answer 5


you can do like this..

protected void button_Click(object sender, EventArgs e)          {              // Your Code Here //              string RedirPageUrl = "url";              ClientScript.RegisterClientScriptBlock(this.GetType(), "someKeyRedir""window.location.href = '" + RedirPageUrl + "';"true);          }  

Regretfully that doesn't work. All browsers  now stay on the page  with the entry  form... no redirection.


Answer 6


Yes, you can use JavaScript to perform redirection after executed server  side code and depends on some conditions. Please have a try.

' Use this code instead of HttpContext.Current.Response.Redirect(l_sURL)
HttpContext.Current.Response.Write("<script type='text/javascript'>window.location.href='" & l_sURL & "';</script>")

Have a nice day.


Answer 7

Wenchao Zeng - MSFT:

' Use this code instead of HttpContext.Current.Response.Redirect(l_sURL)  
HttpContext.Current.Response.Write("<script type='text/javascript'>window.location.href='" & l_sURL & "';</script>") 

Thank you for the suggestion, but this doesn't result in a redirect  to the other URL. And all browsers  now refuse to redirect again, not only Chrome.


Answer 8

When running  in debug mode, and using the 'Response.Write' method, I get an error like: "Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server  could not be parsed. Common causes for this error are when the response  is modified by calls to Response.Write(), response filters, HttpModules, 
or server trace is enabled. Details: Error parsing near ..."

The OK and Cancel buttons are inside an UpdatePanel, so that is likely the cause of the problem. 

But it's not so simple to put them outside the UpdatePanel, as the UpdatePanel is in the MasterPage, and the OK and Cancel buttons are on ContentPages.

Is there a solution to this without losing the UpdatePanel in the MasterPage?


Answer 9

I found my solution:

        Dim l_oSM As AjaxControlToolkit.ToolkitScriptManager = AjaxControlToolkit.ToolkitScriptManager.GetCurrent(Page)
        If l_oSM IsNot Nothing Then
            AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(Page, Page.GetType(), "wsReturnToPreviousPage", "window.location.href='" & l_sURL & "';", True)
            Page.ClientScript.RegisterStartupScript(Page.GetType, "wsReturnToPreviousPage", "window.location.href='" & l_sURL & "';", True)
        End If

I hope this helps anyone else who's struggling with the same issue  and finds this forum thread.

Thank you all who contributed to this topic!



Hi there,

 I used small business starter kit, modified it for my project, it validates at W3C CSS Validation Service, and looks great in IE 7.0.

PROBLEM: Google Chrome does not draw the menu correctly - it is pushed to the right and jumbled.

Has anyone solved this problem?

I appreciate any response.



Hi, I've used autocompleteextender inside a repeater control. On OnClientItemSelected event of autocompleteextender i am setting some hidden field value to use it on server. The code is working fine in all browsers except google chrome. Actually when i traced the code, event is occuring and hidden field is getting value set but the hidden field value is not appearing on the server. On the server i got empty hidden field.



if i used ajaxscriptmanager and if i used response.redirect in update panle then it is genarating some url with %2f append and throwing 400



VS 2005, AJAX 

I use gridview and I need single and double click for each row in gridview.

When I click once on a row, some action will execute (e.g. next button should be enabled) and when I double click the row there should be redirection to another page.

I used the code below for both single and double click  usage:


protected void GwContainers_RowDataBound(object sender, GridViewRowEventArgs e)
                if (e.Row.RowType == DataControlRowType.DataRow)
                    // Get the LinkButton control in the first cell

                    LinkButton singleClickButton = (LinkButton)e.Row.Cells[8].Controls[0];
                    // Get the javascript which is assigned to this LinkButton

                    string jsSingle =
                    ClientScript.GetPostBackClientHyperlink(singleClickButton, null);
                    // To prevent the first click from posting back immediately

                    // (therefore giving the user a chance to double click)

                    // pause the postbackfor 300 milliseconds by

                    // wrapping the postback command in a setTimeout

                    jsSingle = jsSingle.Insert(11, "setTimeout(\"");
                    jsSingle += "\", 300)";
                    // Add this javascript to the onclick Attribute of the row

                    e.Row.Attributes["onclick"] = jsSingle;

                    // Get the LinkButton control in the second cell

                    LinkButton doubleClickButton = (LinkButton)e.Row.Cells[9].Controls[0];
                    // Get the javascript which is assigned to this LinkButton

                    string jsDouble =
                    ClientScript.GetPostBackClientHyperlink(doubleClickButton, null);
                    // Add this javascript to the ondblclick Attribute of the row

                    e.Row.Attributes["ondblclick"] = jsDouble;



protected void GwContainers_RowCommand(object sender, GridViewCommandEventArgs e)
            GridView _gridView = (GridView)sender;
            // Get the selected index and the command name

            int selectedIndex = int.Parse(e.CommandArgument.ToString());
            string commandName = e.CommandName;

            switch (commandName)
                case ("SingleClick"):
                    this.GwContainers.SelectedIndex = selectedIndex;
                    // TODO: ACTIVATE btnNext
                case ("DoubleClick"):
                    this.GwContainers.SelectedIndex = selectedIndex;

I use <asp:UpdatePanel> in my aspx page and my gridview must be in that panel, since I also use some ajax controls...

First problem occurs when I want to double click on a row.  In GwContainers_RowCommand e.CommandName is "DoubleClick", but because of UpdatePanel, this event after "DoubleClick", catch "SingleClick", too. When I use simple data to fill gridview an double click, no mater two passing through the GwContainers_RowCommand, Response.Redirect(pageUrl); redirects me to another page.

But, since I have to use data using  webservice, from database, process for double click act like this:

Sometimes it redirect me to another page (pageUrl), but sometimes it stays to that page where gridview is.

I have mechanism which tells that item is visited, so when I double click on item and it stays on that page still, it is recognized as visited in system, but there is no message in result label for that item.

I hope that I am clear :)


Why I have problems with redirecting? It seems that in  page (pageUrl) are many data, so redirection is not finished totally..





I have a strange issue. I am using the AjaxControlToolkit 3.0.30930 (the most recent). I have a very simple page with an UpdatePanel. A button on the UpdatePanel invokes Response.Redirect and passes the URL of a Click Once application on the same server. This works well if I run the website on my local system (Windows 7, IIS 7.5).

If I run the website on a remote system (Windows Server 2008, IIS 7.5, same settings) the redirect simply does not work when invoking the page from remote (using the IP address). Instead a postback is executed. Even if I use the IP address of the webserver to invoke the website locally on the webserver, the redirect does not work. Using http://localhost on the webserver the redirect works well.

I tried another test page with no UpdatePanel: The redirect works well in all scenarios.

I tried out to invoke the ClickOnce application using a link instead of Response.Redirect: The redirect works well in all scenarios, even with an UpdatePanel.

Does anyone have a clue what the problem might be?


Here is the ASPX:


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestWithUpdatePanel.aspx.cs" Inherits="TestWithUpdatePanel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <form id="MainForm" runat="server">

    <ajaxToolkit:ToolkitScriptManager ID="ScriptManager" runat="server"
    <asp:UpdatePanel ID="udpMain" runat="Server">
            <asp:Button ID="btnTestRedirect" runat="server" Text="Test Redirect" OnClick="btnTestRedirect_Click"
                Width="185px" SkinID="NoSkin" />


Here is the Code:


using System;

public partial class TestWithUpdatePanel : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        if (this.IsPostBack == false)
            string cdhUrl = "";
            this.lblClientDocumentHandlerURL.Text = cdhUrl;
            this.txtRedirectUrl.Text = cdhUrl;

    protected void btnTestRedirect_Click(object sender, EventArgs e)

Even if setting EnablePartialRendering to false, the redirect works. This is a big clue, that the UpdatePanel causes the problem.


I put this code in my aspx file :


when I access my aspx file through Internet I can download the file "Test.exe" but my internet security doesn't permit to install it.

Has anyone had this problem ?

I need help .... Do I need to download otherwise?

tks so much

Luciana Silvestre



I use this code:


to download the file "Test.exe" but when I access the aspx file through internet I can download without problems but my internet security doesn't permit to install it.

Anyone already had this problem? what Do I have to do to install this file in my pc ? 

I have to download my file otherwise?


I have a page where I want to keep several combo boxes adjacent to each other. I have put them in divs that are floated left.

This works fine in IE, Firefox. But when I render the same page on Chrome I observe the uneven gap between combo boxes. Upon analysis I found out that each combo box is occupying space based on the data inside it.

This happens because on Safari and Chrome, the option list control is placed differently as compared to that on IE and Firefox.

Please see the following code from ComboBox.pre.js (in AjaxControlToolkit source/Server/)

        // force inline display on Safari by moving the list to the bottom of the form.
        if (Sys.Browser.agent === Sys.Browser.Safari || Sys.Browser.agent === Sys.Browser.WebKit) {
            var parent = this.get_element().parentNode;
            while (typeof (parent) != typeof (document.forms[0])) {
                parent = parent.parentNode
            var safariListContainer = document.createElement('div');
            safariListContainer.className = this.get_element().className;

This is how it looks:

Combo Boxes awry on Google Chrome

I have tried doing the following but none of them helped:

Changed the RenderMode of combo box to 'block' from 'inline'Commented the lines above in combobox.pre.js

Basically, as per my study, unlike IE and FF, on Chrome, the outer combo box div occupies space as the width of absolutely placed ul present inside it which anyways doesn't seem to be a correct implementation.

How to circumvent the problem? Any help in this regard would be really appreciated.




All --

I think that sometimes maintainscrollpositiononpostback is not working in Google Chrome 5.0.353.70 beta.

Has anyone else experienced this?

Does anyone have a fix for this?

Does anyone have an alternative for this?

Please advise.

Thank you.

-- Mark Kamoski


So TempData works on my local machine in chrome, but not out on the server. It works fine in IE and firefox. I'm using the default Session State as InProc. I can see the cookie in chrome by looking at the developer tools.


Hello --

I have begun to use Safari frequently for the first time, due to my recent installation of IE9 Beta.  I'd tell you all sorts of stories about how IE9 is failing in routine daily usage, but it would take too much time.

In addition to that, the "Send Feedback" selection on the IE9 Tools leads to a dead end, even though this addon, Windows Live ID Sign-in Helper, is installed and enabled.

Last week, I was unable to locate a simple method to un-install IE9 Beta and restore Windows 7 IE8.

I am a Microsoft stockholder and would certainly support the company's efforts to improve IE9 Beta, but I might have to use Safari to do it.

The campers are unhappy,



 I'm tring to put up a Text Editor it works in all the browsers except Chrome has any one had this problem


i have used file upload on one of my web page..the file path is not shown in google chrome..rest in all browser the path is shown..in google chrome only the file name is shown and not the whole path..i want the path to be shown in google chrome

plz help me


Hi there, i have did some research on this topic. But what i have try to search still cannot solve my problem in Firefox.

 I have a textbox with textmode= multiline. i put a wrap= true is becoz i wan to display the address line by line and same as how the users input. I have tested in IE,Google Chrome and Firefox, two browser is not working except the IE.


<asp:TextBoxID="txtContactAddress"runat="server"CssClass="txtbox"TextMode="MultiLine"Text='<%#Eval("ContactAddressForApproval") %>'Wrap="true"></asp:TextBox>


when i display the address in website, i got a function to break line as below:


<asp:LabelID="lblContactAddress"Text='<%# GetAddress(Eval("ContactAddress"))%>'runat="server"></asp:Label>



PublicFunction GetAddress(ByVal strAddress AsString) AsString

Return Replace(strAddress, vbCrLf, "<br>")



Do anyone have idea on how to solve tis problem for Firefox and Google chorme?

please give me a hand. thank you in advance





Earlier today I was attempting to install a piece of software and it told me that I needed .NET Framework 1.1.432 for it to work. Not knowing very much about what .NET is, I went in search of what to do. I believe I installed .NET Framework 1.1.432 because the program I was originally working on started working. Well, after this happened, my Google Chrome completely stopped working. No matter what page or site I go to, I get the blue screen that says "Aw, Snap! Something went wrong..." and blah blah blah. This was the ONLY program effected. I'm on Firefox right and it's fine. Anyways, I really like using Chrome so I'm hoping someone can work with me to resolve this. There may not be a lot of information in this question but if someone is to help me, I'll explain it in more detail.


Thanks in advance!


VS 2008, ASP.NET 3.5

Description of problem

I would like to display a navigation on all pages in a website.  I try to achieve this by placing a drop-down list control in the master page, so all pages can inherited this navigation link.  The Auto-postback is set to "true", and the code behind handles the event "SelectedIndexChanged", and depends on the user selection, they are redirected to the relevant page. 

This works ok in IE 8, but it does not work with other web browsers (Firefox 3.5.13, Google Chrome 7.0.517.41, Opera 10.10, Safari 5.0.2).  Although the drop down list is visible, the selection cannot be changed.  The drop-down list values does not render, even the tool tip is not displayed.  It just appears as an image.  Is there something that I am missing here?  Please could you assist? 


Codes in MasterPage.master

<div id="QuickJumpList" visible="false">

        <asp:DropDownList ID="ddlQuickJumpList" runat="server" SkinID="QuickJumpList" AutoPostBack="True"
            <asp:ListItem>Quick Links:</asp:ListItem>
            <asp:ListItem>About Us</asp:ListItem>
            <asp:ListItem>Project 1</asp:ListItem>
            <asp:ListItem>Project 2</asp:ListItem>
            <asp:ListItem>Contact Us</asp:ListItem>


Codes in MasterPage.master.cs

 protected void ddlQuickJumpList_SelectedIndexChanged(object sender, EventArgs e)
        hfSelectedQuickJump.Value = ddlQuickJumpList.SelectedValue;
        Response.Write("Selected value = " + ddlQuickJumpList.SelectedValue);

        if (ddlQuickJumpList.SelectedValue == "Quick Links:")

 else if (ddlQuickJumpList.SelectedValue == "Home")
        else if (ddlQuickJumpList.SelectedValue == "About Us")
 else if (ddlQuickJumpList.SelectedValue == "Project 1")
 else if (ddlQuickJumpList.SelectedValue == "Project 2")
 else if (ddlQuickJumpList.SelectedValue == "Contact Us")
        if (hfSelectedQuickJump.Value != "")
            ddlQuickJumpList.SelectedValue = hfSelectedQuickJump.Value;






I can't believe that my Silverlight app is almost 2 times faster in Google Chrome browser than IE 9.  Is it me or there's something I don't understand ?


Just now viewing the silverlight.net/showcase website has not been a good experience.

I started with the Google Chrome browser version 8.0.552.224 and I get the 'Loading Silverlight Applications' animated logo in the middle, takes a while then I get the icons for all the different sites. The Weather station by Telerik looks interesting so I click on that and get a popup dialog with a 'View Now' button so I click on that.... nothing ... have I clicked on the button? I'll try again ... click  ....  nothing. Tried a few more times but not working, ok so I tried the Cubemania one, this loads something, music begins playing but no screen, nothing and the only way to turn the music off is to close Google Chrome.

I got it to work in Firefox. I knocked off the top box with the smiley face with the first shot, nothing happened so I knocked off the next box then it told me I had failed! hey!  Then I had quite a job closing the firefox browser window.

All in all, rather clunky, slow, buggy, not a good experience for a showcase, when running Cubemania in IE 8.0.7600* it took up to 95% processor and my whole machine behaved like a donkey with three broken legs and one in plaster and the 'connecting to chat' part didnt'.


Sorry guys, I know you have put a tremendous amount of work into Silverlight but I calls em as I seez em.

I think that the showcase shows what may be possible with silverlight on a good day with the wind behind you and the sun shining but this won't do, you have to have it work, click - BAM it works and anything less will probably just be left in the toybox.







Just reporting (maybe someone else can confirm) a bug we're seeing on our end. After discovering that Chrome does a wonderful job of quickly rendering our pages (much faster than IE or Firefox), several of the heavy page editors have adopted it as their main browser. 

However, they're just reported to me (and I've confirmed on my machine; video will be attached) that when text is entered into a Plain Text field on a List Item, that about a second after it's entered, it disappears. 

To replicate: 

* Create an empty Custom List

* Add three fields: Text (make it Multiple Lines of Text > Plain Test), Rich Text (Multiple Lines of Text > Rich Text) and Enhanced (Multiple Lines of Text > Enhanced Text). 

* In my condition, these were all required fields. 

* Add a list item, and enter information into each of the fields. Information entered into the Text field will disappear.... 

Video - http://www.youtube.com/watch?v=A8vres18yXQ

This doesn't manifest itself in other browsers or conditions - only the Plain Text field, or its equivalent. Rich Text or Enhanced Text fields do not show this behavior. I'll post a video example (just uploading to a hosting site now). 

Can anyone else replicate? How to go about reporting?


It seems my computer has been infected,  it runs very slowly, and when using the Google search engine, it redirects to nasty websites.  I don't want to reinstall the system, anyone can recommend a useful program to help me remove them?

<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure