In this chapter, we will look at how to start a simple example using ASP.NET Web Pages. To begin with, we will create a new website and a simple web page.
To start with, launch Microsoft WebMatrix which we have installed in the previous chapter.
We will create a blank site and then and add a page. To start with, click New and it will display the built-in templates.
Templates are pre-built files and pages for different types of websites. To see all of the templates that are available by default, select the Template Gallery option.
Select the Empty Site template and enter the Site Name. In this case, we have entered FirstWebPageDemo as the Site Name and then we have to click Next.
It will install the required packages. Once the installation is finished, WebMatrix creates and opens the site as shown in the following screenshot.
Now to understand and become familiar with WebMatrix and ASP.NET Web Pages, let’s create a simple web page by clicking New in the Home tab.
WebMatrix displays a list of file types as shown in the following screenshot.
Select CSHTML, and in the Name box, enter FirstPage.cshtml and click Ok.
Now you can see that WebMatrix has created the page and opens it in the editor.
Let us first update the FirstPage.cshtml page as shown in the following program.
@{ } <!DOCTYPE html> <html lang = "en"> <head> <meta charset = "utf-8" /> <title>Welcome to ASP.NET Web Pages Tutorials</title> </head> <body> <h1>Hello World, ASP.NET Web Page</h1> <p>Hello World!</p> </body> </html>
Now to test this web page, let’s select the arrow which is below the Run option on the Home tab and select Internet Explorer as shown in the following screenshot.
Now you will see the following empty web page.
Now let’s specify the following url − http://localhost:46023/firstpage in the browser and you will see the following output.