HighTechTalks DotNet Forums  

How come I can not catch IHTTPModule Error Event???

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss How come I can not catch IHTTPModule Error Event??? in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
John
 
Posts: n/a

Default How come I can not catch IHTTPModule Error Event??? - 05-08-2006 , 01:34 PM






I am writing a custom httpmodule, I can catch BeginRequest, EndRequest
event,
But I can not catch Error event, I tried throwing an error from my Web
Service, creating a security exception (by login the web service with
invalid user name 3 times)
Did I do any thing wrong here? (VS2005)
Please advice.
Thanks in advance.
John


using System;
using System.Diagnostics;
using System.IO;
using System.Web;
using System.Security;

public class MyModule : IHttpModule {
public void Init(HttpApplication app) {

Trace.WriteLine("public void Init(HttpApplication app) {");

app.Error += (new EventHandler(this.Application_OnError));
app.BeginRequest += (new
EventHandler(this.Application_BeginRequest));
app.EndRequest += (new EventHandler(this.Application_EndRequest));
Trace.WriteLine("public void Init(HttpApplication app) { end");

}
public String ModuleName
{
get { return "HelloWorldModule"; }
}


public void Dispose() {}
private void Application_BeginRequest(Object source, EventArgs e)
{
Trace.WriteLine("Application_BeginRequest(Object source, EventArgs
e)");
HttpApplication application = (HttpApplication)source;
HttpContext context = application.Context;
context.Response.Write("<h1><font color=red>HelloWorldModule:
Beginning of Request</font></h1><hr>");
}

// Your EndRequest event handler.
private void Application_EndRequest(Object source, EventArgs e)
{
Trace.WriteLine("Application_EndRequest(Object source, EventArgs
e)");
HttpApplication application = (HttpApplication)source;
HttpContext context = application.Context;
context.Response.Write("<hr><h1><font color=red>HelloWorldModule:
End of Request</font></h1>");
}


private void Application_OnError(object sender, EventArgs args)
{
Trace.WriteLine("Application_OnError(Object source, EventArgs e)");
HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;
context.Response.Write("<h1><font color=red>ON
ERROR</font></h1><hr>");

Trace.WriteLine("static void OnError(object sender, EventArgs args)
{");

}

}


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.