I wrote a very simple httpmodule and tried to compile it with no success.
This is my code:
==============
Imports System
Imports System.Web
Imports Microsoft.Visua lBasic
NameSpace myErrorHandler
Public Class myExceptionHand ler
Implements IHttpModule
Public Sub Init (objApp as HttpApplication )
AddHandler objApp.Error, AddressOf Me.OnError
End sub
Public Sub Dispose()
End Sub
Public Sub OnError(Sender as Object, e as EventArgs)
Dim objApp as HttpApplication
objApp = CType(Sender, HttpApplication )
Dim ctx as HttpContext = objApp.Context. Current
Dim exception as Exception = ctx.Server.GetL astError()
Dim errorInfo as string = _
"<br>Offend ing URL: " & ctx.Request.Url .ToString() & _
"<br>Source : " & exception.Sourc e & _
"<br>Messag e: " & exception.Messa ge & _
"<br>Stack trace: " & exception.Stack Trace
ctx.Response.Wr ite (errorInfo)
End Sub
End Class
End Namespace
==============
I am not too sure how to compile the above code because whenever I tried it,
the vbc compiler said that I have to have init and dispose in order to
implement the IHttpModule interface. The problem is, I do have those 2 subs
in my class?
Can someone point out what's wrong with my code for me?
I used the following command in C:\WINNTS\Micro soft.NET\Framew ork\v1.1.4322
to compile the code:
vbc /t:library /r:System.dll,Sy stem.web.dll PGDErrorHandler .vb