IHttpModule

S

silesius

Hi all,
I'm using Visual Studio to create an HttpModule. I created a class library
project added my code and two directives System and System.Web, but every
time I try to compile it gives me this error message "The type or namespace
name 'IHttpModule' could not be found (are you missing a using directive or
an assembly reference?)". What am I missing?
TIA for your help
Sample code:

using System;
using System.Web;

namespace myModules {
public class AuthModule: IHttpModule {

public void Init( HttpApplication myApp ) {
}

public void Dispose() {
}

public void OnEnter( object s, EventArgs e ) {
HttpApplication objApp;
HttpContext objContext;
string strPath;

objApp = (HttpApplication)s;
objContext = objApp.Context;
strPath = objContext.Request.Path.ToLower();

if ( strPath.Substring(strPath.Length-10,10) != "login.aspx" ) {
if ( objContext.Request.Params["username"] == null ) {
objContext.Response.Redirect("login.aspx");
}
}
}

public void OnLeave( object s, EventArgs e) {
}
}
}
 
J

Jim Lawton

Hi all,
I'm using Visual Studio to create an HttpModule. I created a class library
project added my code and two directives System and System.Web, but every
time I try to compile it gives me this error message "The type or namespace
name 'IHttpModule' could not be found (are you missing a using directive or
an assembly reference?)". What am I missing?
TIA for your help

In the solution explorer, under references for the project, have you got both
"system" *and* system.web - my guess, you're missing the latter ...

cheers,
Jim
 

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

Top