locked
Are .asax and .ashx the same thing, HttpHandlers RRS feed

  • Question

  • User-2137848081 posted

    One of my projects has an global.ashx file, it's a HttpHandler, some of the documentation I'm reading refers to a global.asax file which appears to do the same thing, are they the same thing with a different extension?

     

    Wednesday, January 24, 2007 10:04 AM

All replies

  • User300685930 posted

    I think you mean HttpModules.  HttpHandler's are things like the Page Handler.  HttpModules handle events in the HttpPipeline.  Assuming that is what you mean, 

    there are suttle differences.

    When the HttpPipeline starts, at some point the HttpApplication is created.  When it is created, it uses the Global.asax for this.  Because of this, the global.asax has some extra events in it like application_start.

    Otherwise, you can handle most of the events exactly the same in an HttpModule.

     

    Wednesday, January 24, 2007 12:17 PM
  • User300685930 posted
    gosh, I just reread your question and realized I answered the wrong one.  sorry.  I don't know what a global.ashx file is and how it might be different from any other ashx file.  Sorry.
    Wednesday, January 24, 2007 12:22 PM
  • User-2137848081 posted

    Actually i've reread my post too, it's actually not global but MyApp.ashx. I haven't got it to hand now but it implements IHttpHandler and overrides  some methods, it's can be used to handle State. The asax file is for something else. So I think they are completely different topics.

    If anyone can clear rhis up please post. I'll do some more digging tomorrow.
     


     

    Wednesday, January 24, 2007 2:59 PM
  • User-2137848081 posted

    I've documented some of my findings at learnerps_dotnet blog

     One more question:

    Is there any need for a Global.asax HttpModule with Application_Error(object sender, EventArgs e) override AND  a .asax HttpHandler with a public void ProcessRequest(HttpContext context)
        {     if (context.Error != null)
    overrride in the same application. Is it overkill to have the two? 

    Will the HttpModule be Application_Error handler be entered first is there is an Error?

    Both of mine are mapped to *.aspx, i have no custom file extensions.

     

    Monday, January 29, 2007 10:05 AM