I am working on site which is scattered in multiple subdomains. From the main site I have to create url which points to sudomains. How can I do this.
for example, my main site is http://www.mysite.com
I need to create a url pointing to blog.mysite.com/userId/Name which will point to HomeController and Index method witch userId and name.
Also, how should I handle the urls on local machine as well on the production machine.
Help will be appreciated
updating my question here.
What does
@Html.ActionLink("MyLink","Index","Profile","","www.test.com",null,null,null)
do.
It creates a link, but with port number in it. If there is anyway I can avoid it.
Regards
Parminder
As your sub domains will host their own applications with controller and actions I’d recommend to use the good old HTML hyperlink to create that link:
Why: Because you do not want to couple your disjoint applications and ASP.NET MVC does not have a clue (and should not have a clue) about the routes used in some other application. For constructing the link you can add an extension method to HtmlHelper to avoid typos and URL path encoding quirks.