Search code examples
javascriptc#asp.net-mvcvisual-studiourl

Changing Local Url


I'm starting a new project on my own and have a newbie question that I can't figure out.

Right now I'm creating an MVC project in Visual Studio using C# and Javascript. When I run the solution locally it pops up as ip;

Example: 111.0.0.2:7070

Although I'm trying to add different controllers like /secondpage etc.. I'm used to having it run like;

localhost:7070/default

How do I change it to the latter? Thanks


Solution

  • Welcome!

    Assuming you are using the latest version of Visual Studio your best best is to:

    1. Right click on your project
    2. Select properties
    3. Click "Web" on the left hand side
    4. Under servers you can change the "Project Url" to "https://localhost:7070/"
    5. Above that, under "Start Action", you can choose "Specific Page"
    6. Set this to "default"

    Your application should start as https://localhost:7070/default.

    Also, you can change https to http if you aren't developing in https.

    The other answer of updating your host file would also work as a workaround.