我的 web.config 中有以下内容:
<customErrors defaultRedirect="/error/1" mode="Off" redirectMode="ResponseRedirect">
<error redirect="/404.aspx" statusCode="404" />
</customErrors>
和
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/404.aspx" responseMode="ExecuteURL" />
</httpErrors>
404.aspx.vb
Partial Class _404
Inherits System.Web.UI.Page
Protected Overrides Sub Render(writer As HtmlTextWriter)
MyBase.Render(writer)
Response.StatusCode = 404
End Sub
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim lang As String = Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName
GlobalFunctions.ReportError("404 URL", Request.UrlReferrer.Host.ToString)
End Sub
End Class
在我的 404.aspx 的代码隐藏中,我想首先存储请求的 URL。我该怎么做?如果在 404.aspx.vb 中不可能,我想知道我还能如何将请求存储在我的数据库中。
谢谢!