Avatar of taz8020
taz8020
Flag for United Kingdom of Great Britain and Northern Ireland asked on

ASP.net redirect button cuases error on some ie browsers

Hi Behind my search button I have the code below. It all worked well on trial, but now it has gone live finding that the below code cuases the error the page to show in some ie browsers. Firefox and chrome seem fine. If I turn off custom errors the page just hangs and does nothing if I turn on custom errors you get my error page.
May be its the time it takes to redirect I just dont know. Please help asap as site is now live.

If Me.TextBoxQuickSearch.Text.Length > 0 Then
            Dim SearchString As String = Me.TextBoxQuickSearch.Text
            If Right(SearchString, 1) = "s" Then
                SearchString = SearchString.Remove(SearchString.Length - 1)
            End If
            Response.Redirect("~/SearchResults.aspx?Search=" & SearchString)
        Else
            Me.TextBoxQuickSearch.Text = "No Text"
        End If 

Open in new window


ASP Mark Up
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="QuickSearch.ascx.vb" Inherits="QuickSearch" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="SearchButton">
        <div style="z-index: 0">
    <table style="width:100px;">
        <tr>
            <td>
                <asp:TextBox ID="TextBoxQuickSearch" runat="server" BackColor="#FFCCFF"></asp:TextBox>
                <ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" 
                    TargetControlID="TextBoxQuickSearch" WatermarkCssClass="SearchWaterMark" 
                    WatermarkText="Search For A Product...">
                </ajaxToolkit:TextBoxWatermarkExtender>


<ajaxToolkit:ToolkitScriptManager ID="ScriptManager2" runat="server">
</ajaxToolkit:ToolkitScriptManager>
            
            </td>
            <td align="left">
                <asp:ImageButton ID="SearchButton" runat="server" 
                    ImageUrl="~/Images/SiteImages/Search.png" style="height: 22px" />
            </td>
        </tr>
    </table>
    </div>
</asp:Panel>

Open in new window


This is a duplicate question as never had an answer on https://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_28078208.html
ASP.NET.NET ProgrammingVisual Basic.NETWeb Languages and StandardsWeb Development

Avatar of undefined
Last Comment
Ark

8/22/2022 - Mon
Yiogi

Is there any chance you are having an infinite loop in your redirections? i.e. your searchresults.aspx page is again redirecting to itself? The best way to solve your problem would be to debug your code but if this production and doesn't happen on test that won't be possible for you. Try to change your redirection call to:

Response.Redirect("~/SearchResults.aspx?Search=" & Server.HTMLEncode(SearchString), false)

The false tells it not to end the execution on the current page. This will allow it to finish any pending tasks. The HTMLEncode encodes your search string to a form that can be inserted in the URL. Without it you might find problems with some characters.
taz8020

ASKER
If I take the button out of the update pannel it works fine. Is it something wrong with ie or may be ajaxcontroltoolkit is installed wrong. It all works on chrome and firefox and only on a few computers with IE.

It now happens on 5 buttons on the site. They are all in update pannels and it calculates stuff and shows an icon saying updating etc.

It is driving me mad, maybe its the time it takes to calculate and times out, its about 3 seconds on some buttons.

I have downloaded the new toolkit as can see lots have had the same problem but all there answers did not work. They seem to say you need the lastest version as was a known bug and make sure you use the ajaxToolkit:ToolkitScriptManager  not the asp:ScriptManager.

Some say to add
<httpModules>
       <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
 </httpModules>
but this did not work dont even know how you know the Version and PublicKeyToken

others say enableEventValidation="false" bust still does not work
ASKER CERTIFIED SOLUTION
Ark

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy