Search code examples
c#asp.net-mvc-4custom-routes

ASP.NET MVC 4 Custom URL


I'm new in MVC and I trying to change the default url from http://localhost:55920/ to http://myCustonURL/

My route config:

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 = "Login", action = "Index", id = UrlParameter.Optional }
        );            
    }
}

How Can I do it?


Solution

  • It will only work on your computer, but you can achieve it with this

    In Solution Explorer, right-click the name of the Web site project for which you want to specify a Web server, and then click Property Pages. In the Property Pages dialog box, click the Start Options tab. Under Server, click Use custom server. In the Base URL box, type the URL that Visual Studio should start when running the current project.

    From Here also Here2