IHttpModule

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • silesius

    IHttpModule

    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) {
    }
    }
    }


  • Jim Lawton

    #2
    Re: IHttpModule

    On Sat, 8 Jan 2005 09:22:00 -0500, "silesius" <look@this.co m> wrote:
    [color=blue]
    >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[/color]

    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

    Comment

    • silesius

      #3
      Re: IHttpModule


      That was it. Thanks


      Comment

      Working...