0

Is it possible to create a rule that has a behaviour similar to the Service.Transfer from ASP ?

Pato
  • 679
  • 8
  • 24

1 Answers1

1

Using IIS7 Rewriting Module you can use a Rewrite Action.

This keeps the original URL but rewrites the path which your application will see and process in a similar way to Server.Transfer.

<rewrite>
  <rules>
    <rule name="Rewrite to article.aspx">
      <match url="^article/([0-9]+)/([_0-9a-z-]+)" />
      <action type="Rewrite" url="article.aspx?id={R:1}&amp;title={R:2}" />
    </rule>
  </rules>
</rewrite>

Have a look at the rules overview.

This essentially is the same as Context.RewritePath.

TheCodeKing
  • 19,064
  • 3
  • 47
  • 70
  • The thing is avoid using Server.Transfer and use the rewrite module. For the nature of the way the url is called, I can't use Server.Transfer! Anyway, thanks for the advice! :) – Pato Sep 01 '11 at 15:31
  • Yeah sorry I missed the IIS URL Rewriting Module in the title, I'll revise. – TheCodeKing Sep 01 '11 at 15:36