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 = (HttpApplicatio n)s;
objContext = objApp.Context;
strPath = objContext.Requ est.Path.ToLowe r();
if ( strPath.Substri ng(strPath.Leng th-10,10) != "login.aspx " ) {
if ( objContext.Requ est.Params["username"] == null ) {
objContext.Resp onse.Redirect(" login.aspx");
}
}
}
public void OnLeave( object s, EventArgs e) {
}
}
}
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 = (HttpApplicatio n)s;
objContext = objApp.Context;
strPath = objContext.Requ est.Path.ToLowe r();
if ( strPath.Substri ng(strPath.Leng th-10,10) != "login.aspx " ) {
if ( objContext.Requ est.Params["username"] == null ) {
objContext.Resp onse.Redirect(" login.aspx");
}
}
}
public void OnLeave( object s, EventArgs e) {
}
}
}
Comment