ASP.NET Web Pages is the latest addition to the ASP.NET platform and provides a web development framework for new developers who want to build simple websites using ASP.NET.
Although ASP.NET Web Pages provides a simple framework, it leverages on the .NET Class libraries, enabling developers to create simple yet powerful web apps. The configuration steps involved are fewer in comparison to WebForms or ASP.NET MVC. ASP.NET Web Pages are developed using the new light Razor syntax which allows you to mix markup (HTML) with server side programming logic. The good ol’ classic ASP days eh!
Here’s how ASP.NET Web Pages fits into the ASP.NET Technology Programming Model
ASP.NET Web Pages are created using WebMatrix. If you are new to WebMatrix, check out my article Introducing WebMatrix
Creating your first ASP.NET Web Application using WebMatrix
Assuming you have WebMatrix installed, start WebMatrix and click the ‘Site From Template’ option. Choose ‘Empty Site’, give it a name and click OK.
From the WebMatrix Environment, click ‘Files’ in the lower right corner and click on Create a New File.
In the next screen that appears, choose a file type.We are going ahead with CSTHML, which is an ASP.NET Web Page using C#.
Click OK.
Add the following code in the <body> tag
Observe the @sign. This is the Razor syntax we are using. Hit Ctrl+S and run the application (F12) and you should see the following.
Congratulations! That was your first web application using ASP.NET Web Pages and WebMatrix.
Difference between WebForms and ASP.NET Web Pages
ASP.NET comes in 3 flavors – ASP.NET WebForms, ASP.NET MVC and the newly introduced ASP.NET Web Pages. While ASP.NET WebForms and MVC are designed for the enterprise developers, ASP.NET Web Pages makes it easy for new developers to get started with ASP.NET.
The official ASP.NET site lists down a difference between the three:
Tweet
No comments:
Post a Comment