Jump to content

ASP.NET

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by DigitalEnthusiast (talk | contribs) at 20:22, 22 December 2006 (→‎See also). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

ASP.NET is a set of web application development technologies marketed by Microsoft. Programmers can use it to build dynamic web sites, web applications and XML web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology.

File:DotNet3.0.png
This technology is a part of .NET Framework 3.0

Even though ASP.NET takes its name from Microsoft's old web development technology, ASP ( also known as "ASP Classic" ), the two differ significantly. ASP.NET is now based on the Common Language Runtime (CLR) meaning programmers can write ASP.NET code using a variety of common programming languages. ( ASP.NET uses the .NET Framework as an infrastructure. The .NET Framework offers a managed runtime environment (similar to Java), providing a virtual machine with JIT and a class library. )

ASPX file format

ASPX is a text file format used to create web-form pages; in programming jargon, the ASPX file typically contains only static HTML or XHTML code where the developer places all the required form fields and text content for the web page. Dynamic code which runs on the server can be placed in an HTML page with a block <% -- dynamic code -- %> which is similar to other web development technologies such as PHP and JSP, but this practice is generally discouraged.

The recommended method for dealing with dynamic program code is to use the code-behind model, which places this code in a seperate file. Depending on the language being used, the code-behind file will be named something to the effect of MyPage.aspx.cs or MyPage.aspx.vb. 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.

Other files

Other file extensions associated with different versions of ASP.NET include:

  • ascx - Web UserControls: custom controls to be placed onto web pages.
  • asmx - web service pages.
  • ashx - custom HTTP handlers
  • master - Master Pages; introduced in version 2.0
  • sitemap - sitemap configuration files
  • skin - theme skin files
  • config - web.config is the only file to use this extension by default, 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.

Performance

ASP.NET aims for performance benefits over other script-based technologies ( including ASP Classic ) by compiling the server-side code to one or a few DLL files on 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.

Developers can also choose to pre-compile their code before deployment, eliminating the need for just-in-time compilation in a production environment.

ASP.NET Compared to ASP Classic

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 it 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.

  • Compiled code means applications run faster with more design-time errors trapped at the development stage.
  • Significantly improved run-time error handling, making use of exceptions and try-catch blocks.
  • Similar metaphors to Windows applications such as controls and events, which make development of rich user interfaces, previously only found on the desktop, possible.
  • An extensive set of controls and class libraries allows the rapid building of applications, plus user-defined controls allow commonly used templates, such as menus.
  • ASP.NET leverages the multi-language capabilities of the .NET CLR, allowing web pages to be coded in VB.NET, C#, J#, etc.
  • Ability to cache the whole page or just parts of it to improve performance.
  • Ability to use the code-behind development model to separate business logic from presentation.
  • If an ASP.NET application leaks memory, the ASP.NET runtime unloads the AppDomain hosting the erring application and reloads the application in a new AppDomain.
  • Session state in ASP.NET can be saved in a SQL Server database or in a separate process running on the same machine as the web server or on a different machine. That way session values are not lost when the web server is reset or the ASP.NET worker process is recycled.
  • Previous versions of ASP.NET (1.0 and 1.1) were criticized for their lack of standards compliance. The generated HTML and JavaScript sent to the client browser would not always validate against W3C/ECMA standards. In addition, the framework's browser detection feature sometimes incorrectly identified web browsers other than Microsoft's own Internet Explorer as "downlevel" and returned HTML/JavaScript to these clients that was crippled or broken. However, in version 2.0, all controls generate valid HTML 4.0, XHTML 1.0 (the default) or XHTML 1.1 output, depending on the site configuration. Detection of standards-compliant web browsers is more robust and support for Cascading Style Sheets is more extensive.

Criticisms of ASP.NET

ASP Classic and ASP.NET can be run side-by-side in the same web application, which allows developers to migrate applications as needed, instead of all at once. Unfortunately, pages written using different versions of the ASP framework can't share Session State without a lot of work on the programmer's part, or the use of third-party libraries.

Unhandled exceptions force the ASP.NET worker processes to shut down - a fresh WP is loaded and the application is restarted. This causes the application to loose all data cached in session state and elsewhere; if the application authenticates users, they will be logged out. This type of error can be very difficult to debug in a large application.

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 (eg. the Login controls, 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. )


Development tools

Several available software packages exist for developing ASP.NET applications:

History

Date Version Remarks New features
January 16, 2002 1.0 First version

released together with Visual Studio .NET

  • Object oriented web application development supporting Inheritance, Polymorphism and other standard OOP features
    • Developers are no longer forced to use Server.CreateObject(...), so early-binding and type safety are possible.
  • Based on Windows programming; the developer can make use of dll class libraries and other features of the web server to build more robust applications that do more than simply rendering html ( ie Exception logging )
April 24, 2003 1.1 released together with Windows Server 2003

released together with Visual Studio .NET 2003

  • Mobile controls
  • Automatic input validation
November 7, 2005 2.0

codename Whidbey
released together with Visual Studio 2005 and Visual Web Developer Express
and SQL Server 2005

  • New data controls (GridView, FormView, DetailsView)
  • New technique for declarative data access (SqlDataSource, ObjectDataSource, XmlDataSource controls)
  • Navigation controls
  • Master pages
  • Login controls
  • Themes
  • Skins
  • Web parts
  • Personalization services
  • Full pre-compilation
  • New localization technique
  • Support for 64-bit processors
  • Provider class model

ASP.NET Team Members

Various ASP.NET team members maintain blogs. Here are some of them:

See also

Resources about ASP.NET

  • Pro ASP.NET 2.0 in C# 2005, Matthew MacDonald, Apress, November 27, 2005. ISBN 1-59059-496-7
  • ASP.NET 2.0 Unleashed, Stephen Walther, Sams Publishing, June 6, 2006. ISBN 0-672-32823-2
  • Essential ASP.NET With Examples in C#, Fritz Onion, Addison-Wesley Professional, February 11, 2003. ISBN 0-201-76040-1
  • Programming ASP.NET, Jessy Liberty & Dan Hurwitz, O'Reilly, October, 2005. ISBN 0-596-00916-X

Microsoft

 + *Microsoft's ASP.NET website 
 + *ASP.NET on MSDN 
 + *CSS friendly ASP.NET 2.0 control adapters 
 + *Visual Web Developer Express Edition 2005 
 + *Microsoft Expression Web Designer (Standards-compliant css-based design) 
 + *Webmatrix for ASP.NET 
 +  
 +   + z