2006-11-20

 

Asp.Net2.0 HandleModule的應用

1.新增ErrorHandleModule.class在app_code

2.Implements System.Web.IHttpModule 按下enter,自動產生code

3.加入要執行的code
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
Dim app As HttpApplication = CType(sender, HttpApplication)
Dim ex As Exception = app.Server.GetLastError().GetBaseException()
app.Server.ClearError()
app.Response.Redirect("~/Error.aspx")
End Sub

4.Init加入code
AddHandler context.Error, AddressOf Application_Error

5.註冊到web.config的區段





6.dll的註冊方式

Comments: 張貼留言



<< Home

This page is powered by Blogger. Isn't yours?