0
votes

I am redesigning an existing website to an ASP.NET MVC. When deploying I am planning to deploy this as an App in IIS - App is named as -dweb- . Now I need to redirect all the incoming URL to

http://www.xyz.com to http://www.xyz.com/dweb

However for the end user/browser the url redirect is not transparent, they should not see the redirected url.

Is it better to do in Routing or URL Rewrite Module ? Any sample Route / Rewrite rules ?

1

1 Answers

0
votes

In your RouteConfig.cs (or RouteConfig.vb), change the default route path:

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

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

You will need a View named dweb.cshtml under \Views\Home to display the page.