詳しくは、
http://www.developer.com/db/article.php/10920_3426051_2
にありますが、どうも日本語では見つからなかったので覚書です。
Sub Application_Error(ByVal sender As Object, _
ByVal e As EventArgs)
' Fires when an error occurs
' Check to see whether we came
' from the upload form
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
' For other errors, just accept the default processing
End Sub
0 件のコメント:
コメントを投稿