tags:

views:

151

answers:

4

I have my site hosted on a subfolder (ApplicationPath). I have ISAPI Rewrite to translate from www.domain.com/Subfolder to www.domain.com. The problem is that asp.net MVC Html.ActionLink() (and similar functions) generates URLS with www.domain.com/Subfolder. I want to be able to remove the "/Subfolder" from the URL as the ISAPI Rewrite will take care of making the link work. How do i do this? Please, i've tried it like a million times with no success.

A: 

I don't believe there's a way to do this that is built in to the framework. You'll have to write your own Html helper extension method.

John Sheehan
A: 

I think you should write your own Route class witch will rewrite URIs.

Artem Tikhomirov
A: 

overriding the Route class didn't work, it doesn't handle the ApplicationPath. I think i have to override the GetVirtualPath of the RouteCollection class but i don't know how to do this.

+1  A: 

In your route class override the GetVirtualPath method having it add "../" to the beginning of the Url property of the VirtualPathData object returned by the base.GetVirtualPath call.

Sean Lynch