Welcome to this review of Web Page, the 7th module of the Pluralsight course One ASP.NET From Scratch by Jesse Liberty and Jeff Fritz.
Jeff Fritz is a Program Manager for Microsoft in the ASP.NET and Azure Developer Experience teams.
Currently, he leads the NuGet team and manages the MSDN Web Developer Tools blog.
Prior to joining Microsoft, he was a Microsoft MVP, ASPInsider, INETA Community Champion and Developer Advocate for Telerik.
Also in this series:
Jeff describes Web Pages as a throw back to Classic ASP. This isn’t selling it to me very well all. I still have nightmares each night.
First Web Pages Application Demo
Jeff creates a Web Pages project with Razor v2. We see the starter page looks the one we saw earlier in the Web Forms and MVC demos.
Jeff codes in the view Default.cshtml
Simple Data Access
There are only two methods: Query and Execute.
Data Access Demo
This uses a SQL Server compact file. We can see the data using the Visual Studio Server Explorer.
Jeff writes an inline database query, and an inline update statement, in the view. Everything is in the view.
There is one ValidationHelper object. We can use it to set:
- Minimum Value
- Maximum Value
- Maximum Length
We have a new view, AddProduct.cshtml.
Jeff demonstrates how to set fields as required, set required string lengths, check inputs are numbers, and enforce a valid range.
Web Pages Helpers
Helpers are compiled code that assists in generating HTML markup.
Jeff shows off the WebGrid helper and then installs the ASP.NET Web Helpers Library using NuGet.
Then he demonstrates these:
The Gravatar helper, which fetches your Gravatar image
The Twitter helper has TweetButton and FollowButton methods.
The Facebook helper has a LikeButton method.
Overall, Web Pages represents a very easy way to throw together a basic web site or very small application.
The final part on Web API is coming soon