views:

251

answers:

1

I'm running a bunch of apps on discountasp.net with the subdomain addon. Since with shared hosting I can't have multiple IIS sites, I've also written an HTTP module that allows sites in subfolders to operate as if they are running in the root directory. So for example, instead of hosting my blog at dandoes.net/blog, I can host it at blog.dandoes.net (which is really actually dandoes.net). This has been working famously until now, when I'm trying to use it along with MVC.

The HtmlHelper generates its urls based on the virtual path of the application rather than the path data in the URL. So, if I'm on blog.dandoes.net and I want to link to blog.dandoes.net/Samples, I might have this code:

<%=Html.ActionLink("Samples", "Index", "Samples")%>

In normal circumstances, this would generate the url blog.dandoes.net/Samples, but instead, it generates blog.dandoes.net/Blog/Samples because the virtual directory is /Blog.

I could probably take 5 minutes and write something really hacky to do what I want, but I think it would be really interesting if I could get the MVC framework to do what I want.

So, is there any way I could get it to render the correct urls?

+1  A: 

The HTML helper is just a class that returns a string to your code. All you need to do is write your own helper class to output the string in the format you need.

Tony Borf