This post discusses about ASP.NET Web Forms 4.5 features, Web Forms in 4.5 allows you to build dynamic web sites quickly and easily. Web Forms generates much cleaner code on client-side with Unobtrusive Validation in this version. You can also build data-centric applications easily with data-binding features.
If you like to host your ASP.NET Web Forms 4.5, you can have a look at asphostcentral.com
Typical Web Form which contains more fields and validation controls can generate more code on client-side. When you run this typical form in browser then you can see the page size as below
Take a typical Search Form which shows the results in list view. Inside list view you have item template which is having multiple calls to the EVAL expression as shown below
The above method is the standard way of doing data-binding in web forms. You optimize the above using strongly typed data controls.
You can set the Item Type property of List View to the type that you actually data-binding to as shown below
Now you can member variables in place of Eval expressions, member variables are now typed and you will get an Intel license on item class
You may be familiar with Model Binding in ASP.NET MVC, The typical code which you might write in web forms to bind the results in web forms as below
The above code talking to the data base by building a query which does a case insensitive search then it coverts into list binds the results to list view. Let us re-write the above code using Model-Binding
Now there is no page load and click-handler, The above code is not directly interacting with the page. You can populate the formTerm and qsTerm variables using attributes Control and QueryString in model-binding.
The return result of GetResults method is IQueryable. Because the result is of type IQueryable the control has the ability to modify this before it is rendering it to the page. You can use this in sorting and paging. You can specify the same in markup.
Advantage of using Model Binding
As the code is not directly interacting with the page, you can fairly easily unit test the method or even move it to the completely different class.
Support for OpenID in OAuth Logins
The AuthConfig.cs file is standard in all new projects that created in ASP.NET 4.5 in Visual Studio 2012. You can see there are number of external services code is commented out and it is ready to use by putting your custom application credentials.
These are the features which you can try out in Visual Studio 2012.