T
tshad
I am trying to build an HttpModule and am building just the skeleton part of
the program in VS 2003 and am getting a couple of errors. But this is how I
have seen the file built in a couple of different places.
The errors are:
C:\VSProjects\HttpModules\HttpModules.cs(6): The type or namespace name
'IHttpModule' could not be found (are you missing a using directive or an
assembly reference?)
and
C:\VSProjects\HttpModules\HttpModules.cs(9): The type or namespace name
'HttpApplication' could not be found (are you missing a using directive or
an assembly reference?)
I am building this as a class library and the Using clauses are the same as
I have seen elsewhere. Do I need something else (I assume I do)?
*********************************************************
using System;
using System.Web;
namespace HttpModuleExamples
{
public class CustomHttpModule : IHttpModule
{
//IHttpModule Members
public void Init(HttpApplication httpApp)
{
httpApp.BeginRequest += new EventHandler(this.OnBeginRequest);
httpApp.EndRequest += new EventHandler(this.OnEndRequest);
}
public void Displose()
{
//Usually nothing has to happen here
}
// Event Handlers
public void OnBeginRequest(object o, EventArgs ea)
{
HttpApplication httpApp = (HttpApplication) o;
HttpContext ctx = HttpContext.Current;
ctx.Response.Write("Beginning Request <br>");
}
public void OnEndRequest(object o, EventArgs ea)
{
HttpApplication httpApp = (HttpApplication) o;
HttpContext ctx = HttpContext.Current;
ctx.Response.Write("Ending Request <br>");
}
}
}
*********************************************************
Thanks,
Tom
the program in VS 2003 and am getting a couple of errors. But this is how I
have seen the file built in a couple of different places.
The errors are:
C:\VSProjects\HttpModules\HttpModules.cs(6): The type or namespace name
'IHttpModule' could not be found (are you missing a using directive or an
assembly reference?)
and
C:\VSProjects\HttpModules\HttpModules.cs(9): The type or namespace name
'HttpApplication' could not be found (are you missing a using directive or
an assembly reference?)
I am building this as a class library and the Using clauses are the same as
I have seen elsewhere. Do I need something else (I assume I do)?
*********************************************************
using System;
using System.Web;
namespace HttpModuleExamples
{
public class CustomHttpModule : IHttpModule
{
//IHttpModule Members
public void Init(HttpApplication httpApp)
{
httpApp.BeginRequest += new EventHandler(this.OnBeginRequest);
httpApp.EndRequest += new EventHandler(this.OnEndRequest);
}
public void Displose()
{
//Usually nothing has to happen here
}
// Event Handlers
public void OnBeginRequest(object o, EventArgs ea)
{
HttpApplication httpApp = (HttpApplication) o;
HttpContext ctx = HttpContext.Current;
ctx.Response.Write("Beginning Request <br>");
}
public void OnEndRequest(object o, EventArgs ea)
{
HttpApplication httpApp = (HttpApplication) o;
HttpContext ctx = HttpContext.Current;
ctx.Response.Write("Ending Request <br>");
}
}
}
*********************************************************
Thanks,
Tom