In this section, we will create a new web application using visual studio and understand the basic building blocks of Asp.net Application. You will create a simple "Hello World" web app by using an ASP.NET project template and the C# programming language.
Before you begin
Install Visual Studio
If you have not already installed Visual Studio, go to the Visual Studio downloads page to install it free.
Create a project
To start, you will create an ASP.NET Core web application project. The project type comes with all template files to create a web app, before you have even added anything!
1. Open Visual Studio.
2. On the start window, choose Create a new project.
3. On the Create a new project window, enter or type ASP.NET in the search box. Next, choose C# from the Language list, and then choose Windows from the Platform list.
After you apply the language and platform filters, choose the ASP.NET Core Web Application template, and then choose next.
4. In the Configure your new project window, type or enter HelloWorld in the Project name box. Then, choose Create.
5. In the Create a new ASP.NET Core Web Application window, verify that ASP.NET Core 3.0 appears in the top drop-down menu. Then, choose Web Application, which includes example Razor Pages. Next, choose Create.
Visual Studio opens your new project.
Create and run the app
1. In the Solution Explorer, expand the Pages folder, and then choose Index.cshtml.
This file corresponds to a page that is named Home in the web app, which runs in a web browser.
Easy Learning with "Run Example"
Our "Run Example" tool displays the ASP.NET code and the HTML output simultaneously.
Click on the "Run Example" button to see how it works:
Web Pages Example
<h1>Hello Web Pages</h1>
<p>The time is @DateTime.Now</p>
ASP.NET Web Pages
Web Pages is one of many programming models for creating ASP.NET web sites and web applications.
Web Pages provides an easy way to combine HTML, CSS, and server code:
- Easy to learn, understand, and use
- Uses an SPA application model (Single Page Application)
- Similar to PHP and Classic ASP
- VB (Visual Basic) or C# (C sharp) scripting languages
In addition, Web Pages applications are easily extendable with programmable helpers for databases, videos, graphics, social networking and more.
Thank you for visit our website