G
Guest
Hi!
I am using the following code to redirect and display custom error message.
But its not working properly. Its giving the same error instead of the cusotm
error
web.config :
<configuration>
<system.web>
<httpRuntime maxRequestLength="4000"/>
</system.web>
</configuration>
Global.asax :
If Path.GetFileName(Request.Path) = _
"UploadForm.aspx" Then
' Get the error details
Dim appException As System.Exception = _
Server.GetLastError()
Dim checkException As HttpException = _
CType(appException, HttpException)
' Verify the expected error
If checkException.GetHttpCode = 400 And _
checkException.ErrorCode = -2147467259 Then
' Error 400 = bad request, user
' tried to upload a file that's too large
Session("ImageTooLarge") = True
Server.ClearError()
' Go to the original target page
Response.Redirect("UploadForm.aspx")
End If
End If
Thanks,
Baren
I am using the following code to redirect and display custom error message.
But its not working properly. Its giving the same error instead of the cusotm
error
web.config :
<configuration>
<system.web>
<httpRuntime maxRequestLength="4000"/>
</system.web>
</configuration>
Global.asax :
If Path.GetFileName(Request.Path) = _
"UploadForm.aspx" Then
' Get the error details
Dim appException As System.Exception = _
Server.GetLastError()
Dim checkException As HttpException = _
CType(appException, HttpException)
' Verify the expected error
If checkException.GetHttpCode = 400 And _
checkException.ErrorCode = -2147467259 Then
' Error 400 = bad request, user
' tried to upload a file that's too large
Session("ImageTooLarge") = True
Server.ClearError()
' Go to the original target page
Response.Redirect("UploadForm.aspx")
End If
End If
Thanks,
Baren