ASP.Net MVC ActionLink's and Shared Hosting Aliased Domains

Posted by Peter Meyer on Stack Overflow See other posts from Stack Overflow or by Peter Meyer
Published on 2009-03-03T01:52:11Z Indexed on 2010/04/02 15:53 UTC
Read the original article Hit count: 313

So, I've read this and I've got a similar issue:

I have a shared hosting account (with GoDaddy, though that's not exactly relevant, I believe) and I've got an MVC (RC1) site deployed to a sub-folder which where I have another domain name mapped (or aliased). The sub-folder is also setup as an application root as well.

The site works without issue, the problem is that I don't like the links that are being generated using Html.ActionLink and Ajax.ActionLink. It's inserting the sub folder name as part of the URL as described in this other question. Thing is, the site works fine, but I'd like to make the links generated relative to the domain name.

To use an example:

http://my.abc.com    "primary" domain; maps to \ on file system
http://my.xyz.com    setup to map to \_xyz.com folder on file system

My generated links on xyz.com look like this:

Intended                              Generated
--------                              ---------
http://my.xyz.com/Ctrller/Action/52   http://my.xyz.com/_xyz.com/Ctrller/Action/52

and, FWIW, the site works.

So, the question: Is there something I can do to get rid of that folder name in the links being generated? I have a couple of brute force ideas, but they aren't too elegant.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about shared-hosting