1
votes

I'm at starter level for for ASP.NET Core. I have some html pages crafted by HTML5 and CSS3. I want show this pages with ASP.NET Core Razor Pages. So, I opened a new empty ASP.NET Core Project (Default is razor page I think.)

I copied the images and CSS file to wwwroot folder. Lastly, I copied my html codes into a new Razor Page (Main.cshtml) which is in "/Pages" folder. The page can see the CSS, the CSS can see the images. However, Edge gives 404 error while running the project. I think I cannot do the routing correctly:

404 error

Code

Can you help me? Thanks.

2

2 Answers

1
votes

Write This Code To Your Startup

1-in ConfigureServices:

services.AddMvc();
services.AddMvc().AddRazorPagesOptions(options =>
{
    options.Conventions.AddPageRoute("/Index", "{*url}");
});

2-in Configure:

app.UseStaticFiles();
    app.UseMvc();
0
votes

In order to access your razor page you will have to use the following url:

http://localhost:50551/Main

if you want to create a razor page which will be the default page for a domain, you should give it the name index.cshtml.