【问题标题】:Response.Redirect raises an unknown errorResponse.Redirect 引发未知错误
【发布时间】:2018-09-17 08:50:07
【问题描述】:

在我的网页中,我使用 Response.Redirect 将我的用户重定向到另一个页面。 我正在使用 ASP vb.net,当我尝试重定向时出现此错误:

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

你知道哪里错了吗?

提前谢谢你。

这是我的代码:

<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

【问题讨论】:

  • 它真的说“第一次机会例外”吗?如果是这样,那么可能根本没有任何问题。请对您所看到的内容、在何处以及何时看到提供完整且清晰的解释。如果信息是我所说的,您应该研究该术语以了解其实际含义。
  • 嗨,我正在尝试在我的公共子系统中调用 Response.Redirect,但它引发了 System.Web.HttpException。我不知道他的类型,因为 VS 控制台没有为我提供任何信息。你知道另一种形式的重定向吗?我可能需要任何图书馆或任何东西吗?在我的索引页面 (page_load) 中它运行良好。
  • Why Response.Redirect causes System.Threading.ThreadAbortException? 的答案是否会阻止引发异常?另外,请重新阅读 jmcilhinney 评论的第一部分 - 可能没有问题。

标签: javascript html asp.net vb.net


【解决方案1】:

尝试使用以下代码重定向 URL。

Response.Redirect(URL,false)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-07
    • 2012-01-27
    • 1970-01-01
    相关资源
    最近更新 更多