Run a managed module for a rewritten URL in IIS7 integrated mode

In my ASP.NET application, I have two HTTP modules. One of them is used to rewrite URLs, the other is used for specific applications (user authentication, etc.). The URL rewrite module runs for all requests, while the other one runs only for managed file extensions such as .aspx

Here's how the modules are defined in web.config (note that preCondition is empty for UrlRewriteModule. This leads to its execution for all requests):

<system.webServer>
  <modules>
    <add name="UrlRewriteModule" type="MySite.UrlRewriteModule" preCondition="" />
    <add name="SiteModule" type="MySite.SiteModule" preCondition="managedHandler" />
  </modules>
</system.webServer>

In UrlRewriteModule, I use RewritePath () to rewrite some URLs (similar to directories) to query string files. For example, from "/ p / 5 / some-thoughts-about-the-future /" to "/post.aspx?id=5"

Now I have the impression that when the URL is being rewritten, IIS7 runs the managed module (SiteModule in this case) if there is a new URL for the managed extension (e.g. .aspx). But this does not seem to be the case. I noticed that the SiteModule is not running for any rewritten URLs.

Am I missing something (or is something wrong) or is this normal behavior in IIS7?

Server.TransferRequest(), (, ). . , .

, SiteModule , URL- Server.TransferRequest()?

!

+3

Source: https://habr.com/ru/post/1780224/


All Articles