Integral mode Rewritepath and IIS

I have a big problem with url rewriting for IIS 7.0.

I wrote a simple rewrite module for my NET3.5 / IIS7 web application. Here is some of the code.

    public void Init(HttpApplication context)
    {
        context.BeginRequest += new EventHandler(context_BeginRequest);
    }

    void context_BeginRequest(object sender, EventArgs e)
    {
        HttpApplication app = sender as HttpApplication;
        if (app.Request.Path.Contains("pagetorewrite.aspx"))
            HttpContext.Current.RewritePath("~/otherpage.aspx");
    }

      

And I register my module in web.config:

  <system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
              <add name="MyModule" type="MyModule" preCondition="" />

      

In IIS 7.0 (Vista) using Classic ASP Pipeline, it works fine, but when I change the pipeline mode to Integrated it stops working. There are no exceptions, errors and everything in debugger / events / logfiles messages, only this page was not found in the browser. The scariest part is that the pagename looks wrong or is merged from parts of the original page and rewritten to the page.

I deployed my code on another machine (also vista -but x64- and iis 7.0) and it works fine in both modes. Looks like there is a configuration issue or what?

+1


source to share


3 answers


Finally I found a working solution.



.NET 3.5 TransferRequest

0


source


Just guess: qualify your type with the assembly name (type = "MyModule, MyAssembly")



0


source


Ok, I recommend using the URL Rewrite module released by Microsoft that has been tested.

http://learn.iis.net/page.aspx/460/using-url-rewrite-module/

Wish you like it.

0


source







All Articles