0

I've followed some basic tutorials to create ASP.NET 5 with MVC 6 and AngularJS applications.

I've got a setup like so:

index.html
app.js

When I load the project, I have to go to index.html, or set it as the Launch URL to naturally visit my webpage. this means that the url browser shows:

http://localhost:16510/index.html

How can I set up the ASP.NET 5.0 project so that when the user goes to / it views index.html?

e.g.

http:localhost:16510/
1
  • Your situation may be different...however I always right click the project in the solution explorer select properties then click web then under "Start Action" select the option "Specific Page" and the leave the textbox blank your project should start up on the default "home" page. Assuming that your using Visual Studio... Commented Dec 23, 2015 at 16:03

1 Answer 1

6

You should put the code of index.html in the /Views/Home/Index.cshtml.

In the startup.cs you have your default route configuration.

app.UseMvc(routes =>
{
    routes.MapRoute(
        name: "default",
        template: "{controller=Home}/{action=Index}/{id?}");
});

This tells that your default controller is Home and default action method is Index. So whenever you accesss your site without a controllername & action name in your url, the request will be send to Home/Index. Your url will be http://yourSiteName

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

Comments

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.