Question

When i return View() from my action, result URL was not include virtual directory name.

expect for this

...../MyMVCApp/Controller/Action

but i got this

..../Controller/Action

How can i fix this problem?

Thank you in advance.

EDIT: My RouteConfig.cs is

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Con", action = "Index", id = UrlParameter.Optional }
        );

and on IIS(6.1) I just add application on the some root site like this

Website
 |
 |- MyMVCApp
 |- OtherApp
Was it helpful?

Solution

This shouldn't be an issue at all as long as your virtual directory is a web application in IIS. If you have configured your project as a web app and you still have issues then it should be a routing problem.

By saying that, I believe your issue is IIS configuration or a routing problem. Can you paste a screenshot of your IIS structure and how you are registering your routes?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top