Overrides IHttpModule

  • Thread starter Thread starter Andy G
  • Start date Start date
A

Andy G

I am trying to implement the global error handling described on this page...
http://www.dotnetdevs.com/articles/GlobalErrorHandling.aspx

I'm a VB person and don't understand much of C# when it gets more
complicated. Can someone please help me with the following statement that
is in C#, I need this in VB and have been using Patel's converter but just
can't get rid of the errors in VS.NET.

void IHttpModule(HttpApplication application) {
_application = application;
_application.Error += new EventHandler(ErrorHandler);
}


ERROR:
'Public Event Error(sender As Object, e As System.EventArgs)' is an event,
and cannot be called directly. Use a 'RaiseEvent' statement to raise an
event.

It's choking on the 2nd line of code.

Thanks so much!
 
Andy,
void IHttpModule(HttpApplication application) {
_application = application;
_application.Error += new EventHandler(ErrorHandler);
}


Private Sub IHttpModule(HttpApplication application)
_application = application;
AddHandler _application.Error, AddresOf ErrorHandler
End sub

I hope this helps,

Cor
 
Cor,
Close :-)
Private Sub IHttpModule(ByVal application As HttpApplication)
_application = application
AddHandler _application.Error, AddressOf ErrorHandler
End sub

However the AddHandler is the important part ;-)

My Concern is this method is a constructor or not...

Hope this helps
Jay
 
Jay,

I (and you) saw only have only that part of the code, so only on that I can
answer.

I was first thingking where comes that from. Although not completly
understanding what you mean, do I probably agree with what you wrote.

My thought was when it is not working, there will be a reply again, and that
is probably better than to ask for a more detailed question.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top