views:

43

answers:

2

Hi,

i'm creating a mvc application and i'll use under subdomain like

http://myapp.mycompany.com

This subdomain is pointing to app subdirectory, but my actions are always generated with applicationPath (subdirectory) like:

http://myapp.mycompany.com/myapp/Home/About
// I want just this without additional paths
http://myapp.mycompany.com/Home/About

Is there any configuration related to this? Is this the correct way to generate links?

<%= Html.ActionLink("About", "About", "Home") %>
+1  A: 

Your subdomain should be handled by IIS and your routes should ignore this. As far as Asp.net MVC application goes it doesn't really matter where your application is located and how IIS is configured.

routes.MapRoute("Default", "{controller}/{action}/{id}", ...);

If you'd call Html.ActionLink() the way you've written, there should be no myapp in generated paths.

Can you provide your route definition(s) from global.asax?

Robert Koritnik
A: 

Hi Robert, thanks for help.

My Global.asax is default, i didn't create custom routes. See below:

routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Leandro
If nothing else has been done/was used and you create links the way you've written, everything should be fine. I guess it has to be something with IIS configuration.
Robert Koritnik