1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim con As New Connexion
Dim g As String
Dim ex1 As HttpException = TryCast(Server.GetLastError().GetBaseException(), HttpException)
If ex1 IsNot Nothing AndAlso ex1.ErrorCode = -2147467259 Then
Dim oConfigSection As System.Web.Configuration.HttpRuntimeSection = DirectCast(ConfigurationManager.GetSection("system.web/httpRuntime"), System.Web.Configuration.HttpRuntimeSection)
If Request.ContentLength > oConfigSection.MaxRequestLength * 1000 Then
g = Request.Url.GetLeftPart(UriPartial.Authority) & _
VirtualPathUtility.ToAbsolute("~/")
Dim adresse As String
adresse = g & "Default.aspx"
HttpContext.Current.Session("Error") = ex1.Message
Response.Redirect(adresse)
End If
End If
con = Nothing
End Sub |
Partager