asp.net和PHP
本主題所列的逐步解說 (教學課程) 精選,將說明 ASP.NET 的 Web 程式開發概念。 這些逐步解說內容將同時涵蓋 Visual Studio 2010 和 Visual Web Developer 2010 Express (統稱為 Visual Studio) 中的 Web 開發功能。
除了這些逐步解說之外,Visual Studio 文件中的許多主題章節,都包含重要功能的逐步解說。
以下为英文原版教程。
ASP.NET is a Web application framework developed and marketed by Microsoft to allow programmers to build dynamic Web sites, Web applications and Web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages.
Contents
[hide]
* 1 History
* 2 Characteristics
o 2.1 Pages
o 2.2 Directives
+ 2.2.1 Examples
# 2.2.1.1 Inline code
# 2.2.1.2 Code-behind solutions
o 2.3 User controls
o 2.4 Custom controls
o 2.5 Rendering technique
o 2.6 State management
+ 2.6.1 Application
+ 2.6.2 Session state
+ 2.6.3 View state
+ 2.6.4 Server-side caching
+ 2.6.5 Other
o 2.7 Template engine
o 2.8 Other files
o 2.9 Directory structure
* 3 Performance
* 4 Extension
* 5 ASP.NET compared with ASP classic
* 6 Criticism
* 7 Development tools
* 8 Frameworks
* 9 Versions
* 10 Other implementations
* 11 Notes
* 12 References
* 13 Further reading
* 14 External links
[edit] History
After the release of Internet Information Services 4.0 in 1997, Microsoft began researching possibilities for a new Web application model that would solve common complaints about ASP,
especially with regard to separation of presentation and content and being able to write "clean" code.[1] Mark Anders, a manager on the IIS team, and Scott Guthrie, who had joined Microsoft in 1997 after graduating from Duke University, were tasked with determining what that model would look like. The initial design was developed over the course of two months by Anders and Guthrie, and Guthrie coded the initial prototypes during the Fall of 1997.
除了這些逐步解說之外,Visual Studio 文件中的許多主題章節,都包含重要功能的逐步解說。
以下为英文原版教程。
ASP.NET is a Web application framework developed and marketed by Microsoft to allow programmers to build dynamic Web sites, Web applications and Web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages.
Contents
[hide]
* 1 History
* 2 Characteristics
o 2.1 Pages
o 2.2 Directives
+ 2.2.1 Examples
# 2.2.1.1 Inline code
# 2.2.1.2 Code-behind solutions
o 2.3 User controls
o 2.4 Custom controls
o 2.5 Rendering technique
o 2.6 State management
+ 2.6.1 Application
+ 2.6.2 Session state
+ 2.6.3 View state
+ 2.6.4 Server-side caching
+ 2.6.5 Other
o 2.7 Template engine
o 2.8 Other files
o 2.9 Directory structure
* 3 Performance
* 4 Extension
* 5 ASP.NET compared with ASP classic
* 6 Criticism
* 7 Development tools
* 8 Frameworks
* 9 Versions
* 10 Other implementations
* 11 Notes
* 12 References
* 13 Further reading
* 14 External links
[edit] History
After the release of Internet Information Services 4.0 in 1997, Microsoft began researching possibilities for a new Web application model that would solve common complaints about ASP,
The initial prototype was called "XSP"; Guthrie explained in a 2007 interview that, "People would always ask what the X stood for. At the time it really didn't stand for anything. XML started with that; XSLT started with that. Everything cool seemed to start with an X, so that's what we originally named it."[1] The initial prototype of XSP was done using Java,[3] but it was soon decided to build the new platform on top of the Common Language Runtime (CLR), as it offered an object-oriented programming environment, garbage collection and other features that were seen as desirable features that Microsoft's Component Object Model platform did not support. Guthrie described this decision as a "huge risk", as the success of their new Web development platform would be tied to the success of the CLR, which, like XSP, was still in the early stages of development, so much so that the XSP team was the first team at Microsoft to target the CLR.
With the move to the Common Language Runtime, XSP was re-implemented in C# (known internally as "Project Cool" but kept secret from the public), and the name changed to ASP+, as by this point the new platform was seen as being the successor to Active Server Pages, and the intention was to provide an easy migration path for ASP developers.[4]
Mark Anders first demonstrated ASP+ at the ASP Connections conference in Phoenix, Arizona on May 2, 2000. Demonstrations to the wide public and initial beta release of ASP+ (and the rest of the .NET Framework) came at the 2000 Professional Developers Conference on July 11, 2000 in Orlando, Florida. During Bill Gates' keynote presentation, Fujitsu demonstrated ASP+ being used in conjunction with COBOL,[5] and support for a variety of other languages was announced, including Microsoft's new Visual Basic .NET and C# languages, as well as Python and Perl support by way of interoperability tools created by ActiveState.
With the move to the Common Language Runtime, XSP was re-implemented in C# (known internally as "Project Cool" but kept secret from the public), and the name changed to ASP+, as by this point the new platform was seen as being the successor to Active Server Pages, and the intention was to provide an easy migration path for ASP developers.[4]
Mark Anders first demonstrated ASP+ at the ASP Connections conference in Phoenix, Arizona on May 2, 2000. Demonstrations to the wide public and initial beta release of ASP+ (and the rest of the .NET Framework) came at the 2000 Professional Developers Conference on July 11, 2000 in Orlando, Florida. During Bill Gates' keynote presentation, Fujitsu demonstrated ASP+ being used in conjunction with COBOL,[5] and support for a variety of other languages was announced, including Microsoft's new Visual Basic .NET and C# languages, as well as Python and Perl support by way of interoperability tools created by ActiveState.
Once the ".NET" branding was decided on in the second half of 2000, it was decided to rename ASP+ to ASP.NET. Mark Anders explained on an appearance on The MSDN Show that year that, "The .NET initiative is really about a number of factors, it's about delivering software as a link building service, it's about XML and Web services and really enhancing the Internet in terms of what it can do ... we really wanted to bring its name more in line with the rest of the platform pieces that make up the .NET framework."[4]
After four years of development, and a series of beta releases in 2000 and 2001, ASP.NET 1.0 was released on January 5, 2002 as part of version 1.0 of the .NET Framework. Even prior to the release, dozens of books had been written about ASP.NET,[7] and Microsoft promoted it heavily as part of its platform for Web services. Guthrie became the product unit manager for ASP.NET, and development continued apace, with version 1.1 being released on April 24, 2003 as a part of Windows Server 2003. This release focused on improving ASP.NET's support for mobile devices.
[edit] Characteristics
[edit] Pages
ASP.NET Web pages, known officially as Web Forms,[8] are the main building block for application development.[9] Web forms are contained in files with an ".aspx" extension; these files typically contain static (X)HTML markup, as well as markup defining server-side Web Controls and User Controls where the developers place all the required static and dynamic content for the Web page.
like
After four years of development, and a series of beta releases in 2000 and 2001, ASP.NET 1.0 was released on January 5, 2002 as part of version 1.0 of the .NET Framework. Even prior to the release, dozens of books had been written about ASP.NET,[7] and Microsoft promoted it heavily as part of its platform for Web services. Guthrie became the product unit manager for ASP.NET, and development continued apace, with version 1.1 being released on April 24, 2003 as a part of Windows Server 2003. This release focused on improving ASP.NET's support for mobile devices.
[edit] Characteristics
[edit] Pages
ASP.NET Web pages, known officially as Web Forms,[8] are the main building block for application development.[9] Web forms are contained in files with an ".aspx" extension; these files typically contain static (X)HTML markup, as well as markup defining server-side Web Controls and User Controls where the developers place all the required static and dynamic content for the Web page.
Rubens, Peter Paul Rubens, Rubens paintings, Peter Paul Rubens paintings, famous Rubens paintings, Rubens paintings for sale, Rubens biography,The Three Graces,Rubens paintings list,Rubens art,Rubens artwork
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. With ASP.NET Framework 2.0, Microsoft introduced a new code-behind model which allows static text to remain on the .aspx page, while dynamic code remains in an .aspx.vb or .aspx.cs or .aspx.fs file (depending on the programming language used).[10]
[edit] Directives
A directive is special instructions on how ASP.NET should process the page.[11] The most common directive is <%@ Page %> which can specify many attributes used by the ASP.NET page parser and compiler.
[edit] Directives
A directive is special instructions on how ASP.NET should process the page.[11] The most common directive is <%@ Page %> which can specify many attributes used by the ASP.NET page parser and compiler.
Can you really pull this off? You can if you have a clear understanding of color, saturation, contrast values, forms of leadership, and hard and soft edges. You are a licensed artist and you can create anything you can imagine. If this is true or not, that you must believe before attempting the work of art. Imagine the difference of the scene being shot instead of paint. In a photograph, the deer will always be the focal point, but in many cases the focal point of a photograph is not nearly as captivating as a good painting. Why? It is because a picture has details throughout the image. These details tarnish the focus. If you have any doubt about it, also paint the details throughout the painting and see how you confuse the viewer and dilute the main focal point.
Programmers can also build custom controls for ASP.NET applications. Unlike user controls, these controls do not have an ASCX markup file, having all their code compiled into a dynamic link library (DLL) file. Such custom controls can be used across multiple Web applications and
Turner, William Turner, Turner paintings, William Turner paintings, Turner biography, Turner painter, Turner landscape paintings, Turner reproductions, Turner oil paintings, William Turner paintings, artist Turner paintings
.
[edit] Rendering technique
ASP.NET uses a visited composites rendering technique. During compilation, the template (.aspx) file is compiled into initialization code which builds a control tree (the composite) representing the original template. Literal text goes into instances of the Literal control class, and 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
After the request has been processed, the instance of the page class is discarded and with it the entire control tree. This is a source of confusion among novice ASP.NET programmers who rely on class instance members that are lost with every page request/response cycle.
ASP.NET applications are hosted by a Web server and are accessed using the stateless HTTP protocol. As such, if an application uses
Matisse, Henri Matisse, Matisse drawings, artist Matisse painting, painter Matisse painting, Matisse paintings, madame Matisse painting, Michelangelo, Michelangelo paintings, famous Michelangelo paintings, Michelangelo paintings for sale, Michelangelo biography, Michelangelo paintings list, The Creation of Adam, Last Judgement, Michelangelo paintings Sistine Chapel, Michelangelo paintings names, Michelangelo paintings gallery, Michelangelo paintings images
, 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 output 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. This is a source of confusion among novice ASP.NET programmers who rely on class instance members that are lost with every page request/response cycle.
ASP.NET applications are hosted by a Web server and are accessed using the stateless HTTP protocol. As such, if an application uses
Picasso, Pablo Picasso, Picasso art, Pablo Picasso biography, Picasso Guernica, Picasso cubism, Picasso picture
, it has to implement state management on its own. ASP.NET provides various functions for state management. Conceptually, Microsoft treats "state" as GUI state. Problems may arise if an application needs to keep track of "data state"; for example, a finite-state machine which may be in a transient state between requests (lazy evaluation) or which takes a long time to initialize. State management in ASP.NET pages with authentication can make Web scraping difficult or impossible.
It’s different with
Pissarro, Camille Pissarro, Pissarro paintings, Camille Pissarro paintings, famous Pissarro paintings, Pissarro paintings for sale, Pissarro biography, Pissarro art, Pissarro impressionist, Pissarro paintings landscapes
4.4.0 2005-07-11 Added man pages for phpize and php-config scripts.[31]
4.4.9 2008-08-07 Security enhancements and bug fixes. The last release of the PHP 4.4 series.[33][34]
5 5.0.0 2004-07-13 Zend Engine II with a new object model.[35]
5.1.0 2005-11-24 Performance improvements with introduction of compiler variables in re-engineered PHP Engine.[35] Added PHP Data Objects (PDO) as a consistent interface for accessing databases. [36]
5.2.0 2006-11-02 Enabled the filter extension by default. Native JSON support.[35]
5.2.17 2011-01-06 Fix of critical vulnerability connected to floating point.
5.3.0 2009-06-30 Namespace support; Late static bindings, Jump label (limited goto), Native closures, Native PHP archives (phar), garbage collection for circular references, improved Windows support, sqlite3, mysqlnd as a replacement for libmysql as underlying library for the extensions that work with MySQL, fileinfo as a replacement for mime_magic for better MIME support, the Internationalization extension, and deprecation of ereg extension.
5.3.1 2009-11-19 Over 100 bug fixes, some of which were security fixes.
5.3.2 2010-03-04 Includes a large number of bug fixes.
5.3.3 2010-07-22 Mainly bug and security fixes; FPM SAPI.
5.3.4 2010-12-10 Mainly bug and security fixes; improvements to FPM SAPI.
5.3.5 2011-01-06 Fix of critical vulnerability connected to floating point.
5.3.6 2011-03-10 Over 60 bug fixes that were reported in the previous version.
5.3.7 2011-08-18 This release focuses on improving the stability of the PHP 5.3.x branch with over 90 bug fixes, some of which are security related.
4.4.9 2008-08-07 Security enhancements and bug fixes. The last release of the PHP 4.4 series.[33][34]
5 5.0.0 2004-07-13 Zend Engine II with a new object model.[35]
5.1.0 2005-11-24 Performance improvements with introduction of compiler variables in re-engineered PHP Engine.[35] Added PHP Data Objects (PDO) as a consistent interface for accessing databases. [36]
5.2.0 2006-11-02 Enabled the filter extension by default. Native JSON support.[35]
5.2.17 2011-01-06 Fix of critical vulnerability connected to floating point.
5.3.0 2009-06-30 Namespace support; Late static bindings, Jump label (limited goto), Native closures, Native PHP archives (phar), garbage collection for circular references, improved Windows support, sqlite3, mysqlnd as a replacement for libmysql as underlying library for the extensions that work with MySQL, fileinfo as a replacement for mime_magic for better MIME support, the Internationalization extension, and deprecation of ereg extension.
5.3.1 2009-11-19 Over 100 bug fixes, some of which were security fixes.
5.3.2 2010-03-04 Includes a large number of bug fixes.
5.3.3 2010-07-22 Mainly bug and security fixes; FPM SAPI.
5.3.4 2010-12-10 Mainly bug and security fixes; improvements to FPM SAPI.
5.3.5 2011-01-06 Fix of critical vulnerability connected to floating point.
5.3.6 2011-03-10 Over 60 bug fixes that were reported in the previous version.
5.3.7 2011-08-18 This release focuses on improving the stability of the PHP 5.3.x branch with over 90 bug fixes, some of which are security related.
5.3.8 2011-08-23 This release fixes two issues introduced in the PHP 5.3.7 release.
5.3.9 2012-01-10 This release focuses on improving the stability of the PHP 5.3.x branch with over 90 bug fixes, some of which are security related.
5.3.10 2012-02-02 Fixed arbitrary remote code execution vulnerability reported by Stefan Esser, CVE-2012-0830.
5.4.0 2012-03-01 Trait Support, short array syntax support. Removed items: register_globals, safe_mode, allow_call_time_pass_reference, session_register(), session_unregister() and session_is_registered(). Several improvements to existing features, performance and reduced memory requirements.
6 ?.? No date set The development of PHP 6 has been delayed because the developers have decided the current approach to handling of instance unicode is not a good one, and are considering alternate ways in the next version of PHP. The updates that were intended for PHP 6 were added to
Beginning on June 28, 2011, the PHP Group began following a timeline for when new versions of PHP will be released.[37] Under this timeline, at least one release should occur every month. Once per year, a minor release should occur which can include new features. Every minor release should at least have 2 years of security and bug fixes, followed by at least 1 year of only security fixes, for a total of a 3 year release process for every minor release. No new features (unless small and self contained) will be introduced into a minor release during the 3 year release process.
[edit] Usage
PHP is a general-purpose scripting language that is especially suited to server-side Web development where PHP generally runs on a Web server. Any PHP code in a requested file is executed by the PHP runtime, usually to create dynamic Web page content or dynamic images used on Web sites or elsewhere.[38] It can also be used for command-line scripting and client-side GUI applications. PHP can be deployed on most Web servers, many operating systems and platforms, and can be used with many relational database management systems (RDBMS). It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.[3]
PHP acts primarily as a filter,[39] taking input from a file or stream containing text and/or PHP instructions and outputting another stream of data; most commonly the output will be HTML. Since PHP 4, the PHP parser compiles input to produce bytecode for processing by the Zend Engine, giving improved performance over its interpreter predecessor.
5.3.9 2012-01-10 This release focuses on improving the stability of the PHP 5.3.x branch with over 90 bug fixes, some of which are security related.
5.3.10 2012-02-02 Fixed arbitrary remote code execution vulnerability reported by Stefan Esser, CVE-2012-0830.
5.4.0 2012-03-01 Trait Support, short array syntax support. Removed items: register_globals, safe_mode, allow_call_time_pass_reference, session_register(), session_unregister() and session_is_registered(). Several improvements to existing features, performance and reduced memory requirements.
6 ?.? No date set The development of PHP 6 has been delayed because the developers have decided the current approach to handling of instance unicode is not a good one, and are considering alternate ways in the next version of PHP. The updates that were intended for PHP 6 were added to
Paul Cézanne, Paul Cezanne, Paul Cézanne paintings, Paul Cézanne still life, Paul Cézanne artwork, Paul Cézanne biography, Paul Cézanne drawings, Paul Cézanne famous paintings, Paul Cézanne paintings still life, Paul Cézanne painting names, Paul Cézanne art, The Card Players, Paul Cézanne cubism, Paul Cézanne self portrait, Paul Cézanne painting style, Paul Cézanne painting technique
instead.
Beginning on June 28, 2011, the PHP Group began following a timeline for when new versions of PHP will be released.[37] Under this timeline, at least one release should occur every month. Once per year, a minor release should occur which can include new features. Every minor release should at least have 2 years of security and bug fixes, followed by at least 1 year of only security fixes, for a total of a 3 year release process for every minor release. No new features (unless small and self contained) will be introduced into a minor release during the 3 year release process.
[edit] Usage
PHP is a general-purpose scripting language that is especially suited to server-side Web development where PHP generally runs on a Web server. Any PHP code in a requested file is executed by the PHP runtime, usually to create dynamic Web page content or dynamic images used on Web sites or elsewhere.[38] It can also be used for command-line scripting and client-side GUI applications. PHP can be deployed on most Web servers, many operating systems and platforms, and can be used with many relational database management systems (RDBMS). It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.[3]
PHP acts primarily as a filter,[39] taking input from a file or stream containing text and/or PHP instructions and outputting another stream of data; most commonly the output will be HTML. Since PHP 4, the PHP parser compiles input to produce bytecode for processing by the Zend Engine, giving improved performance over its interpreter predecessor.