locked
httpmodule or httphandler for URL Remapping RRS feed

  • Question

  • User1430299578 posted

    I was just wondering if there is a prefered method for remapping urls (httpmodule vs httphandler), and why? I know I can use both methods, but which is more efficient? I want intercept the request, and redirect the user to the appropriate content page based on some business rules.

     

    Thanks,

    Mike.

    Sunday, July 22, 2007 4:52 PM

Answers

  • User-900677162 posted

    HI, Mke:

    Here is the better blog here to discuss the difference between the two approaches:

    Url Rewriting using IHttpModule vs ISAPI Rewrite

    http://dotnetslackers.com/ASP_NET/re-37950_Url_Rewriting_using_IHttpModule_vs_ISAPI_Rewrite.aspx

    If i misunderstand you about your question, please feel free to correct me and i will try to help you with more information.

    I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be

    of assistance

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 25, 2007 12:24 AM
  • User-1091210821 posted

    All good however httphandlers stand favorites because they plug in the request cycle, as pointed by above posts. however HttpModules are designed to participate in the processing of a request, HttpHandlers are designed to be the endpoint for the processing of a request.

    Figure 1 HTTP Request

    An HttpHandler provides a way to define new page processors that handle new types of programming models.

    Built in ASP.NET HttpHandlers

    HttpHandler

    Purpose

    PageHandlerFactory

    Processes .aspx pages.

    WebServiceHandlerFactory

    Processes .asmx XML Web services.

    HttpForbiddenHandler

    Yields an error message indicating that a type of page is not in service. By default all .asax, .vb, .cs, .ascx, .config, .csproj, .vbproj, .webinfo files are mapped to this in machine.config.

    StaticFileHandler

    Delivers any page that isn't specifically mapped, such as .html, .htm, and .jpg.

    TraceHandler

    Shows the page containing all of the trace output.

     

    However just to let you guys also know that this kind or URL re-writes now have been establish to fiddle with SEO work and it has been established. Even the community server is prone to this bug, well did I say bug...well its the way its written and the way search engines treat it as illegitimate.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 25, 2007 5:57 AM

All replies

  • User1730632263 posted

    if you are using the ASP.NET 2.0 ..then try to use URL mapping.

     If you want to use your own code then HTTPModule is the answer.

    use URLChecking httpmodules. For more info serach on that.
     

    Monday, July 23, 2007 3:12 AM
  • User1430299578 posted

     Thanks, but what I was really asking is why someone might choose a httpmodule vs. a httphandler when creating a url rewrite engine.

     

    Mike. 

    Monday, July 23, 2007 6:40 AM
  • User-900677162 posted

    HI, Mke:

    Here is the better blog here to discuss the difference between the two approaches:

    Url Rewriting using IHttpModule vs ISAPI Rewrite

    http://dotnetslackers.com/ASP_NET/re-37950_Url_Rewriting_using_IHttpModule_vs_ISAPI_Rewrite.aspx

    If i misunderstand you about your question, please feel free to correct me and i will try to help you with more information.

    I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be

    of assistance

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 25, 2007 12:24 AM
  • User-1091210821 posted

    All good however httphandlers stand favorites because they plug in the request cycle, as pointed by above posts. however HttpModules are designed to participate in the processing of a request, HttpHandlers are designed to be the endpoint for the processing of a request.

    Figure 1 HTTP Request

    An HttpHandler provides a way to define new page processors that handle new types of programming models.

    Built in ASP.NET HttpHandlers

    HttpHandler

    Purpose

    PageHandlerFactory

    Processes .aspx pages.

    WebServiceHandlerFactory

    Processes .asmx XML Web services.

    HttpForbiddenHandler

    Yields an error message indicating that a type of page is not in service. By default all .asax, .vb, .cs, .ascx, .config, .csproj, .vbproj, .webinfo files are mapped to this in machine.config.

    StaticFileHandler

    Delivers any page that isn't specifically mapped, such as .html, .htm, and .jpg.

    TraceHandler

    Shows the page containing all of the trace output.

     

    However just to let you guys also know that this kind or URL re-writes now have been establish to fiddle with SEO work and it has been established. Even the community server is prone to this bug, well did I say bug...well its the way its written and the way search engines treat it as illegitimate.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 25, 2007 5:57 AM