|
|
This article or section is missing citations or needs footnotes. Using inline citations helps guard against copyright violations and factual inaccuracies. (January 2008) |
ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any Microsoft .NET language.
Contents |
ASPX is an html file format used to create Webform pages; in programming jargon, the ASPX file typically contains static HTML or XHTML markup, as well as markup defining Web Controls and Web User Controls where the developers place all the required static and dynamic content for the web page. Additionally, dynamic code which runs on the server can be placed in a page within a block <% -- dynamic code -- %> which is similar to other web development technologies such as PHP, JSP, and ASP, but this practice is generally frowned upon by Microsoft except for the purposes of data binding since it requires more calls when rendering the page.
It is recommended by Microsoft for dealing with dynamic program code to use the code-behind model, which places this code in a separate file or in a specially designated script tag. Code-behind files are typically named something to the effect of MyPage.aspx.cs or MyPage.aspx.vb based on the ASPX file name (this practice is automatic in Microsoft Visual Studio and other IDEs). When using this style of programming, the developer writes code to respond to different events, like the page being loaded, or a control being clicked, rather than a procedural walk through the document.
'ASP.NET' uses a visited composites rendering technique. During compilation the template (.aspx) file is compiled into initialization code which will build a control tree (the composite) representing the original (static) template. Literal text goes into instances of the Literal control class, server controls are represented by instances of a specific control class. The initialization code is combined with user-written code (usually by the assembly of multiple partial classes) and results in a class specific for the page. The page doubles as the root of the control tree.
Actual requests for the page are processed through a number of steps. First, during the initialization steps, an instance of the page class is created and the initialization code is executed. This produces the initial control tree which is now typically manipulated by the methods of the page in the following steps. As each node in the tree is a control represented as an instance of a class, the code may change the tree structure as well as manipulate the properties/methods of the individual nodes. Finally, during the rendering step a visitor is used to visit every node in the tree, asking each node to render itself using the methods of the visitor. The resulting HTML code is sent to the client.
After the request has been processed, the instance of the page class is discarded and with it the entire control tree.
|
|
It has been suggested that ASP.NET Web User Controls be merged into this article or section. (Discuss) |
Other file extensions associated with different versions of ASP.NET include:
| Extension | Required version | Description |
|---|---|---|
| asax | 1.0 | Global.asax, used for application-level logic [1] |
| ascx | 1.0 | Web UserControls: custom controls to be placed onto web pages. |
| ashx | 1.0 | custom HTTP handlers. |
| asmx | 1.0 | web service pages. |
| axd | 1.0 | when enabled in web.config requesting trace.axd outputs application-level tracing. Also used for the special webresource axd handler which allows control/component developers to package a component/control complete with images, script, css etc. for deployment in a single file (an 'assembly') |
| browser | 2.0 | browser capabilities files stored in XML format; introduced in version 2.0. ASP.NET 2 includes many of these by default, to support common web browsers. These specify which browsers have which capabilities, so that ASP.NET 2 can automatically customize and optimize its output accordingly. Special .browser files are available for free download to handle, for instance, the W3C Validator, so that it properly shows standards-compliant pages as being standards-compliant. Replaces the harder-to-use BrowserCaps section that was in machine.config and could be overridden in web.config in ASP.NET 1.x. |
| config | 1.0 | web.config is the only file in a specific Web application to use this extension by default (machine.config similarly affects the entire Web server and all applications on it), however ASP.NET provides facilities to create and consume other config files. These are stored in XML format, so as to allow configuration changes to be made with simplicity. |
| cs/vb | 1.0 | Code files (cs indicates C#, vb indicates Visual Basic). Code behind files (see above) have the extension ".aspx.cs" or ".aspx.vb". Other code files (often containing common "library" classes) can also exist in the web folders with the cs/vb extension. In ASP.NET 2 these should be placed inside the App_Code folder where they are dynamically compiled and available to the whole application. |
| dbml | 3.5 | LINQ to SQL data classes file |
| master | 2.0 | Master Pages |
| resx | 1.0 | resource files for internationalization and localization. Resource files can be global (e.g. messages) or "local" which means specific for a single aspx or ascx file. |
| sitemap | 2.0 | sitemap configuration files |
| skin | 2.0 | theme skin files. |
| svc | 3.0 | Windows Communication Foundation service file |
In general, the ASP.NET directory structure can be determined by the developer's preferences. Apart from a few reserved directory names, the site can span any number of directories. The structure is typically reflected directly in the urls. Although ASP.NET provides means for intercepting the request at any point during processing, the developer is not forced to funnel requests through a central application or front controller.
The special directory names (from ASP.NET 2.0 on) are [2]:
ASP.NET aims for performance benefits over other script-based technologies (including ASP Classic) by compiling the server-side code to one or more DLL files on the web server. This compilation happens automatically the first time a page is requested (which means the developer need not perform a separate compilation step for pages). This feature provides the ease of development offered by scripting languages with the performance benefits of a compiled binary. However, the compilation might cause a noticeable delay to the web user when the newly-edited page is first requested from the web server.
The ASPX and other resource files are placed in a virtual host on an Internet Information Services (or other compatible ASP.NET servers; see Other Implementations, below). The first time a client requests a page, the .NET framework parses and compiles the file(s) into a .NET assembly and sends the response; subsequent requests are served from the DLL files. By default ASP.NET will compile the entire site in batches of 1000 files upon first request. If the compilation delay is causing problems, the batch size or the compilation strategy may be tweaked.
Developers can also choose to pre-compile their code before deployment, eliminating the need for just-in-time compilation in a production environment.
Microsoft has released some extension frameworks that plug into ASP.NET and extend its functionality. Some of them are:
ASP.NET attempts to simplify developers' transition from Windows application development to web development by offering the ability to build pages composed of controls similar to a Windows user interface. A web control, such as a button or label, functions in very much the same way as its Windows counterpart: code can assign its properties and respond to its events. Controls know how to render themselves: whereas Windows controls draw themselves to the screen, web controls produce segments of HTML and JavaScript which form part of the resulting page sent to the end-user's browser.
ASP.NET encourages the programmer to develop applications using an event-driven GUI paradigm (event-driven GUI model), rather than in conventional web-scripting environments like ASP and PHP. The framework attempts to combine existing technologies such as JavaScript with internal components like "ViewState" to bring persistent (inter-request) state to the inherently stateless web environment.
Other differences compared to ASP classic are:
On IIS 6.0 and lower, pages written using different versions of the ASP framework can't share Session State without the use of third-party libraries. This criticism does not apply to ASP.NET and ASP applications running side by side on IIS 7. With IIS 7, modules may be run in an integrated pipeline that allows modules written in any language to be executed for any request.[3]
ASP.NET 2.0 produces markup that passes W3C validation, but it is debatable as to whether this increases accessibility, one of the benefits of a semantic XHTML page + CSS representation. Several controls, such as the Login controls and the Wizard control, use HTML tables for layout by default. Microsoft has now gone some way to solve this problem by releasing the ASP.NET 2.0 CSS Control Adapters, a free add-on that produces compliant accessible XHTML+CSS markup. However, some controls still rely on JavaScript.
Several available software packages exist for developing ASP.NET applications:
It is not essential to use the standard webforms development model when developing with ASP.NET. Noteworthy frameworks designed for the platform include:
| Date | Version | Remarks | New features |
|---|---|---|---|
| January 16, 2002 | 1.0 | First version released together with Visual Studio .NET |
|
| April 24, 2003 | 1.1 | released together with Windows Server 2003 released together with Visual Studio .NET 2003 |
|
| November 7, 2005 | 2.0 |
codename Whidbey |
|
| November 19, 2007 | 3.5 |
released together with Visual Studio 2008 |
|
|
|
v • d • e
|
|
|---|---|
| Graphics | Desktop Window Manager · DirectX · Direct3D · GDI · Windows Presentation Foundation · Windows Color System · Windows Image Acquisition · Windows Imaging Component |
| Audio | DirectSound · DirectMusic · XACT · Speech API |
| Multimedia | DirectShow · Windows Media · Media Foundation |
| Web | MSHTML · MSXML · RSS Platform · JScript · ActiveX · BHO · XMLHttpRequest · SideBar Gadgets |
| Data access | Microsoft Data Access Components · Extensible Storage Engine · ADO.NET · Entity Framework · Sync Framework · Jet Engine |
| Networking | Winsock (LSP) · Winsock Kernel · Filtering Platform · Network Driver Interface Specification · Windows Rally · BITS · P2P API |
| Communication | Telephony API |
|
Administration
and management |
Win32 console · Windows Script Host · Windows Management Instrumentation · Windows PowerShell · Task Scheduler · Offline Files · Shadow Copy · Windows Installer · Windows Error Reporting · Windows Event Log · Common Log File System |
| Component model | COM · COM+ · Distributed Component Object Model · .NET Framework |
|
Unmanaged
frameworks |
Microsoft Foundation Class (MFC) · Active Template Library (ATL) · Windows Template Library (WTL) |
| Driver development | Windows Driver Model (Broadcast Driver Architecture) · Windows Driver Foundation (KMDF · UMDF) |
| Security | Crypto API (CAPICOM) · Windows CardSpace · Data protection API · Security Support Provider Interface |
| .NET | Framework · ASP.NET · ADO.NET · Remoting · Windows Presentation Foundation · Windows Workflow Foundation · Windows Communication Foundation · Windows CardSpace · XNA · Silverlight · Task Parallel Library |
| IPC | MSRPC · Named pipes |
| Accessibility | Active Accessibility · UI Automation |
|
Text and multilingual
support |
Text Services Framework · Text Object Model · Input method editor · Language Interface Pack · Multilingual User Interface · Uniscribe |
| Games | Microsoft XNA |
Why are we here?
All text is available under the terms of the GNU Free Documentation License
This page is cache of Wikipedia. History