ASP.NET
ASP.NET ( Active Server Pages. NET) is a server side technology from Microsoft for building dynamic web sites, web applications and web services based on the Microsoft NET Framework. Since 2002, ASP.NET is the successor to the original web technology ASP (Active Server Pages).
ASP.NET comes to about 18.7 % of all websites as server-side programming language used and is thus for PHP ( 81.2 %) in second place, the most widely used language for creating Web sites, and of third-placed Java ( 2.7%).
- 7.1 SOAP Extensions
- 7.2 mono
- 7.3 Silverlight as a supplement option
Building ASP.NET
ASP.NET is built on the. NET Framework and provides a method to. NET applications in IIS or other compatible ASP.NET web servers to host. ASP.NET provides this classes that are common to all Web applications, such as authentication and authorization of users. The most important element here is the HTTP runtime to the HTTP handler to process HTTP requests.
With ASP.NET Web applications can (theoretically all CLR - compatible languages ) are created in. NET supported languages in use are almost exclusively object-oriented languages like C # and VB.NET. The voice is mostly restricted only by the particular development environment. ASP.NET is thus not a programming language, but a bundle of techniques. ASP.NET languages are not interpreted, but is translated into CIL and compiled.
On the ASP.NET platform set the respective technologies, such as ASP.NET WebForms, ASP.NET AJAX, ASP.NET MVC, ASP.NET Dynamic Data, ASP.NET and ASP.NET WebAPI SignalR to which in each case as HTTP handler are implemented.
ASP.NET Web Forms
The Web Forms. form the basic building block in the development of Web content using ASP.NET in its classical form. Web Forms are stored in files with the extension ". Aspx " included. The. Aspx files typically contain static (X ) HTML markup, as well as the so-called Web Controls and User Controls that are processed according to the server-side logic stored on the web server and displayed as dynamic ( X) HTML code. Examples of Web controls that mitliefert Microsoft by default, a calendar control or the GridView are (table view of data).
Additionally, dynamic code contents that are to be executed by the server within a aspx file in the form <% - dynamic code - %>. Shall be deposited. This type of embedding is very similar to the constructs of other web programming languages like PHP, JSP and ASP. However, the developers should avoid using nested within the HTML code program code because the compiler checks this code only when executed on the Web server. The code separately authored code -behind files (see below) is, however, completely checked by the compiler, which achieves a higher maturity security.
The ASP.NET Framework 2.0, Microsoft released the novel approach of the code -behind model. It will remain static content in the. Aspx file while the dynamic code in aspx.vb a file of type. , Or. Aspx.cs respectively. Aspx.fs is outsourced. The file type is dependent on the use. NET language. Developers who do not want to work with the code -behind approach can override the Render function, and ( completely independent from the design view ) generate the HTML here completely yourself.
Code -behind model
Microsoft recommends using the code-behind approach to dynamic code - shares. The code -behind files usually carry the file extension. Aspx.cs or. Aspx.vb. The file name of the. Aspx corresponds always exactly the name of the code -behind file, only the file extensions are different. Microsoft Visual Studio and other IDEs provide this kind of development by default before. The code of such a code-behind file is compiled before calling the appropriate page. This reduces the error rate than interpreted language in which the error checking only takes place at runtime. In the code - behind file, the developer has the opportunity to respond to a wide variety of events in the life cycle of an ASP Web Forms page, including not only eg loading of the website, but also events that result from user interactions with Web form contents, such as the click of a button.
The program model ( with events that are triggered by controls) is very similar to. NET applications, thus is for developers who have written applications for the. NET framework, the use of ASP.NET ( and C # / VB. NET) easy. Most the functions or classes can be used even without a change in ASP.NET for Windows applications.
With this approach, ASP.NET differs markedly from the classic ASP. A first separation of code used to display and the content is achieved. Similarly, the separation between view and controller in MVC pattern, this separation allows a better division of labor in development, for example, by a division between web designers, the aspx edited, and programmer who created the code - behind file. The newer plugin ASP.NET MVC emphasizes conceptual in much stronger form of this type of separation of concerns.
Directives
With Directives, it is possible to declare in an ASPX file as you want ASP.NET to process this page. The most frequently used directive is <% @ Page %>. This lets you add a variety of settings, especially the indication is programmed in the programming language of dynamic content. For example, in this article contains the code example, the <% @ Page %> directive in the first line.
User Controls
The so-called user controls encapsulate certain sections of pages in a separate file with the extension. Ascx. These. Ascx files are registered within the ASP.NET project and can be used in ASPX pages as well as the predefined Web Controls. The. Ascx files typically contain (X ) HTML markup and server- side controls. A user control is compiled, if the page on which the control is bound, is called. The usercontrol is kept for possible subsequent requests in memory. User Controls bring their own events with it, can also be treated by the developer individually. All user controls are linked thereto, to be called from an aspx page. The direct call a user controls in a browser is not possible.
Individualized Controls
Programmers can define their web applications in ASP.NET custom controls. Unlike User Controls Custom controls are not defined in an ascx file, but its code is compiled into a dynamic link library (DLL) file. If he has such a custom control once defined, the developer can use them in different applications and Visual Studio projects.
These opportunities to develop their own controls for ASP.NET, form the basis for a variety of controls from third- party products that are free or available for a fee. There is now a very large market on which a plurality of re-usable controls are free or are commercially available. Complex requirements must therefore be self- developed often do not.
ViewState
ASP.NET supports an extended opportunity to obtain memory contents between individual page views with the ViewState technology. During the session - state technology with Active Server Pages hitherto existed only a detached by the side calling memory management, the developer has in ASP.NET by enabling customers to store content in a ViewState collection to access it the next page load. In contrast to the session state of the ViewState is not saved on the server, but in the returned page.
With the support of ASP.NET ViewState Engineering Controls maintain their status even over successive page requests. That takes developers from the work, to have to implement this yourself. A similar approach will be taken with the Sun Java Server Faces (JSF ).
WebParts
In addition, ASP.NET provides the concept of WebParts. These intranets may be created in which each user configures what he wants to see at what point the page.
Code Example
Aspx file
The sample code below produces when run on the included web server from Visual Studio, create a basic issue on the screen; this follows the standard content that Microsoft generated when you create a new aspx page ( in ASP.NET 4).
= <% @ Page Title = "Home Page " Language = "C #" MasterPageFile = "~ / Site.master " AutoEventWireup "true"
CodeBehind = " Default.aspx.cs " Inherits = " ASP.NET_Beispiel._Default "%>