如何在VB中表示URL

时间:2017-08-28 08:04:48

标签: asp.net vb.net url exception-handling

我想将异常Url作为字符串传递给我创建的方法,以便它在邮件中显示例外Url(已发送)。

我在ApplicationError()

Global.asax事件中完成了以下操作
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when an unhandled error occurs
    Dim lastException As Exception = Server.GetLastError()

    If (lastException Is Nothing) Then
        Return
    End If

    Dim context As HttpContext = HttpContext.Current
    Dim myMethodforMail As New myMethodforMail()
    Dim exUrl As String = context.Request.Url.ToString()
    Dim webServerName As String = Server.MachineName
    myMethodforMail.HandleApplicationError(exUrl, webServerName)
    Server.ClearError()
End Sub 

但网址打印为http://localhost:22035/examplepage.aspx?PageNumber!0331

而不是http://localhost:22035/examplepage.aspx?PageNumber=650331

有人可以帮我解释如何解码网址中的!并代表网址原样。 THANKYOU。

0 个答案:

没有答案