Leandro
Leandro

Reputation: 21

ASP.NET MVC Action with ApplicationPath

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") %>

Upvotes: 2

Views: 636

Answers (2)

Leandro
Leandro

Reputation: 1

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 }
);

Upvotes: 0

Robert Koritnik
Robert Koritnik

Reputation: 105081

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?

Upvotes: 1

Related Questions