2

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

2 Answers 2

1

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?

Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.