Martin
Martin

Reputation: 2971

Url rewrite in ASP.NET MVC or web.config

Ignore the base problem. My custom built javascript library is moronic when it comes to looking up resources. Ok, it's me, but I don't care. At this point I'm looking for an ugly work around.

The client requests

http://localhost/Activities/Index/dojo/resources/blank.gif

and I want to say, your're a moron behind my teeth, but front with a smile and serve the image which of course is located at

http://localhost/dist/dojo/resources/blank.gif

No redirect. I guess it's what's called a rewrite. Solve that for me, please. Either in the route table or web.config, whichever performs the best.

Upvotes: 1

Views: 5748

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038730

This could be easily achieved with the IIS 7.0 rewrite module:

<rewrite>
  <rules>
    <rule name="resources">
      <match url="Activities/Index/(.*)" />
      <action type="Rewrite" url="dist/{R:1}" />
    </rule>
  </rules>
</rewrite>

Upvotes: 2

Related Questions