Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7644623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:44:06+00:00 2026-05-31T09:44:06+00:00

The MSDN documentation says: HttpContext.RemapHandler Method – Enables you to specify a handler for

  • 0

The MSDN documentation says:

HttpContext.RemapHandler Method – Enables you to specify a handler for the request.

I am trying to move the processing of the request from one handler to another depending on a condition in the first handler. The HttpContext.RemapHandler method seems to initialise an instance of the second handler but not call the HttpHandler.ProcessRequest method; the response is empty.

Does the HttpContext.RemapHandler method do what I think it should – transfer processing to a new HttpHandler and calling the HttpHandler.ProcessRequest method? Or should I be using another approach such as another method or an HttpModule?

EDIT:
Turns out I should be using a HTTPHandlerFactory. I have the solution working nicely now.

So what exactly is HttpContext.RemapHandler for?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:44:07+00:00Added an answer on May 31, 2026 at 9:44 am

    You can use HttpContext.RemapHandler as you specified, however if another HttpHandler calls RemapHandler (e.g. ASP.NET MVC which registers MvcHandler in PostResolveRequestCache) your IHttpModule will never fire. This is maybe why IHttpHandler.Process was never called.

    If this is your issue, you can simply define a route to ignore in MvcApplication.RegisterRoutes like this:

    routes.IgnoreRoute("your_path/{*pathInfo}");
    

    Also, remember that with Visual Studio Web Development Server and IIS6, RemapHandler will not work.

    Here is an example of how to select the right way to remap the handler based on whether or not Integrated Pipeline is activated AND still be able to access the session:

    public void Init(HttpApplication application)
    {
      if (HttpRuntime.UsingIntegratedPipeline)
        // For IIS 7 and IIS 8
        application.PostAuthorizeRequest += Application_PostAuthorizeRequest;
      else
        // For IIS 6
        application.PostMapRequestHandler += Application_PostMapRequestHandler;
    }
    
    private void Application_PostAuthorizeRequest(object sender, EventArgs e)
    {
        ((HttpApplication)sender).Context.RemapHandler(_myHandler);
    }
    
    private void Application_PostMapRequestHandler(object sender, EventArgs e)
    {
        ((HttpApplication)sender).Context.Handler = _myHandler;
    }
    

    The difference between using a HttpHandlerFactory and HttpModule in this case is that the latter allows you to decide when to use which IHttpHandler regardless of ASP.NET IHttpHandler mappings. More on MSDN: HTTP Handlers and HTTP Modules Overview.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On the MSDN documentation for Lazy.Force<T> extension method says: Forces the execution of this
The MSDN documentation says that public class SomeObject { public void SomeOperation() { lock(this)
The MSDN documentation on Object.GetHashCode() describes 3 contradicting rules for how the method should
From the MSDN documentation: Synchronized supports multiple writing threads, provided that no threads are
It is unclear to me from the MSDN documentation if I should provide a
I looked up the msdn documentation and it says that InvalidUserName is thrown when
In the MSDN documentation, it says it returns just directory names(Return Value Type: ...
The MSDN documentation says of the exitContext boolean parameter: true to exit and reacquire
The msdn documentation says add namespaces imports to the CodeNamespace.Imports collection. This puts them
I'm calling this method: http://msdn.microsoft.com/en-us/library/dd371264(VS.85).aspx The call fails with E_NOINTERFACE . The documentation is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.