Improvement of ASP. NET Web Forms, asp. netforms

Source: Internet
Author: User

Improvement of ASP. NET Web Forms, asp. netforms

Although ASP. NET Web Forms is not part of the vNext plan, it is not ignored. As part of Visual Studio 2013 Update 2, it restarts to support new tools, EF integration, and Roslyn.

Why Web Forms is not part of ASP. NET vNext

In the beginning, Let's explain the bad news first. To improve performance and cross-platform portability, ASP. NET vNext is eliminating dependency on System. Web. Compared with OWIN, it is slow and huge, making the test work much more unnecessary.

Although they have tried to separate it multiple times, Web Forms is very closely related to other parts of System. Web. That's just the beginning of the problem. System. Web and System. Design have circular dependencies, which should not happen. More complex, System. Design also involves System. Windows. Forms.

All in all, the Web Forms code is like a piece of pasta that cannot be solved. However, it will continue to be used, so Microsoft will still provide support for it.

Support for Roslyn

As part of its deployment policy, Web Forms always includes runtime compilation. This remains unchanged, but as an alternative, developers can switch to the Roslyn-based CodeDOM provider. (CodeDOM is the compiler framework currently used by Web Forms) Pranav Rastogi writes:

We tested an application of moderate size and complexity (there are more than 600 assemblies and more than 500 User Controls & pages under the \ bin directory ), after the new CodeDOM provider is enabled, the compile cost of the Start/pre-compile stage is reduced from about 15 minutes to about 70 seconds.

Supports ASP. NET Identity 2.0

ASP. NET Identity is a new membership management system for building ASP. NET applications. Identity makes it easier to add user configuration files, such as Facebook, Twitter, Microsoft accounts, and Google, and switch the persistent layer from SqlServer to Azure Table Storage. It also provides features such as account validation, two-factor authentication, account locking, single sign-on from any location, password reset, and many other security-related features.

In this update, the Web Forms Template has been modified to include functions from ASP. NET Identity 2.0.

Supported Entity Framework 6

To support EF6, the following components have been updated:

  • EntityDataSource Control
  • DynamicData provider
  • Universal provider
Web Forms scaffolding

Scaffolding is a code generator used for basic CRUD operations in the ASP. net mvc model. It was rewritten in Visual Studio 2013. The result of rewriting is that Microsoft can now provide Scaffolding Support for Web Forms. In particular, developers can create, replace, update, and delete views from a model object.

Readers can read the complete Web Forms announcement from the. NET Web development and tool blog.

Improvements for ASP. NET Web Forms


What are the differences between user controls in ASPNET and WEB forms?

User Controls enable programmers to easily divide and reuse the public UI functions across ASP. net web applications. Similar to WEB forms pages, programmers can use any text editor to create user controls, or use code hiding to develop user controls. In addition, like WEB forms pages, user controls can be compiled and stored in the server memory during the first request, thus reducing the response time of subsequent requests. However, unlike WEB forms pages, user controls cannot be requested independently. user controls must be included in WEB forms pages before they can be used.

Compared with server-side file inclusion (SSI), user controls allow programmers to have more flexibility by accessing the object model supported by ASP. NET. Programmers can program any attribute declared in the control, not just the functions provided by other files, just like any other ASP. NET Server Control.

Although you need to select a language when creating a user control, a programmer can include multiple user controls in a WEB form page created in multiple languages. For example, you can use Visual Basic. NET creates a user control, imports data from XML files, and then creates another user control using C #. The control contains an order form, the two controls are included in the same WEB form page.

In addition, the output of the control can be cached independently of other components in the WEB forms page containing the user control. This technology is called fragment caching. Using it appropriately can improve the performance of the site. For example, if the user control contains ASP.. NET Server Control, but the rest of the page only contains text and simple code running on the server, the programmer can execute fragment cache on the user control to improve the performance of the application.

2. Create a user control

You can create a user control using a text or HTML editor. The user control declaration syntax is similar to the syntax used to create a WEB form page; the main difference between the two is that user controls do not include
User Controls can be as simple as text files, or they can contain other ASP. NET Server controls. The following process briefly introduces a simple logon form that can be included on multiple pages of the application.

Expose attributes, event handlers, and any other code to be included in the user control function in the Code declaration block. You have two options when using the properties of the user control. First, you can define new attributes of user controls and operate on them. Second, you can operate the server control properties that constitute the user control. Example? Why? Why? Extbox WEB Server Control, and provide it with a password id, you can use the PASSWORD. Text syntax to operate on its Text attributes.

[Note] Any ASP. all attributes and methods of the. NET Server Control will be upgraded to the public attributes and methods of the user control.

Step 1: The following code example declares the UserId and Password attributes mapped to the text box of the Code in step 1. You can operate on these attributes on any WEB forms page containing the user control through declaration or programming.

Public MustInherit Class Loginform
Inherits System. Web. UI. UserControl
Protected WithEvents User As System. Web. UI. WebControls. TextBox
Protected WithEvents Pass As System. Web. UI. WebControls. TextBox
Protected WithEvents Button1 As System. Web. UI. WebControls. Button
# Region "code generated by Web forms designer"

'The call is a Web form design... the remaining full text>

An error occurred while creating an aspnet web form application in vs2012.

This problem has been solved.
Step: Open vs2012 --> tool --> extension and update --> online --> download NuGet Package Manager, download and install it, and restart vs2012. OK. Hope to help you
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.