-1

In my webpage I'm using Response.Redirect to redirect my users to another page. I'm using ASP vb.net, and I'm getting this error when I try to redirect:

First exception of type 'System.Web.HttpException' in System.Web.dll

Do you know what is wrong?

Thank you in advance.

Here my code:

<AjaxPro.AjaxMethod(HttpSessionStateRequirement.ReadWrite)>
    Public Sub respuestaPeti(ByVal address As String, ByVal floor As String)

        Dim res As String

        res = pasarPeticion(address, floor)

        Try
            If res = "OK" Then
                Response.Redirect("https://www.google.es/")
            End If
            If res = "NO_OK" Then
                Response.Redirect("https://www.google.es/")
            End If
            If res = "OK_DIRMAL" Then
                Response.Redirect("https://www.google.es/")
            End If
        Catch ex As Exception
        End Try

    End Sub
eugneio dsjgfo
  • 121
  • 1
  • 4
  • Does it actually say "first chance exception"? If so then there may not be any issue at all. Please provide a FULL and CLEAR explanation of what you see, where you see it and when. If the message is what I said, you should research that term to see what that actually means. – jmcilhinney Sep 17 '18 at 08:56
  • Hi, I'm trying to call Response.Redirect in my Public Sub, but it raises a System.Web.HttpException. I don't know his type cause VS console doesn't provide me any information. Do you know another form to redirect? Is possible I need any library or anything? In my index page (page_load) it works perfectly. – eugneio dsjgfo Sep 17 '18 at 09:13
  • Does the answer at [Why Response.Redirect causes System.Threading.ThreadAbortException?](https://stackoverflow.com/a/2777204/1115360) stop the exception from being raised? Also, please re-read the first part of jmcilhinney's comment - there may be no issue. – Andrew Morton Sep 17 '18 at 10:39

1 Answers1

0

try following code for the redirect the URL.

Response.Redirect(URL,false)
Hrishikesh
  • 299
  • 1
  • 14