Execute HtttModule for extionsionless URL only

Posted by Malcolm Frexner on Stack Overflow See other posts from Stack Overflow or by Malcolm Frexner
Published on 2010-03-31T16:17:32Z Indexed on 2010/04/01 22:23 UTC
Read the original article Hit count: 315

Filed under:
|
|

I have an httpModule which has to run before an ActionMethod. I dont want that it is executed when a request for an image comes in.

For some reasons I realy need an HttpModule and cant use an ActionFilter

What is the way to do this?

public class PostAuthenticateModule : IHttpModule
{

        public void Init(HttpApplication app)
        {
           app.PostAuthenticateRequest += new EventHandler(this.OnEnter);
        }

        private void OnEnter(object source, EventArgs eventArgs)
        {

        }

        private static void Initialize()
        {

        }
        public void Dispose()
        {
        }


}

web.config

<httpModules>
  <add type="PostAuthenticateModule.PostAuthenticateModule , PostAuthenticateModule" name="PostAuthenticateModule"/>
</httpModules>

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about httpmodule