【读书笔记】Introducing ASP.NET

Differences between ASP.NET and earlier web development platforms:

• ASP.NET features a completely object-oriented programming model, which includes an eventdriven, control-based architecture that encourages code encapsulation and code reuse.

• ASP.NET gives you the ability to code in any supported .NET language (including Visual Basic, C#, J#, and many other languages that have third-party compilers).


• ASP.NET is dedicated to high performance. ASP.NET pages and components are compiled on demand instead of being interpreted every time they’re used. ASP.NET also includes a fine-tuned data access model and flexible data caching to further boost performance.

These are only a few of the features, which include enhanced state management, practical data binding, dynamic graphics, and a robust security model.

Seven Important Facts About ASP.NET

  

Fact 1: ASP.NET Is Integrated with the .NET Framework

Fact 2: ASP.NET Is Compiled, Not Interpreted

One of the major reasons for performance degradation in classic ASP pages is its use of interpreted script code. Every time an ASP page is executed, a scripting host on the web server needs to interpret the script code and translate it to lower-level machine code, line by line. This process is notoriously slow.

ASP.NET applications actually go through two stages of compilation. In the first stage, the C# code you write is compiled into an intermediate language called Microsoft Intermediate Language (MSIL), or just IL. This first step is the fundamental reason that .NET can be language-interdependent.
Essentially, all .NET languages (including C#, Visual Basic, and many more) are compiled into virtually identical IL code. This first compilation step may happen automatically when the page is first requested, or you can perform it in advance (a process known as precompiling). The compiled file with IL code is an assembly.

The second level of compilation happens just before the page is actually executed. At this point, the IL code is compiled into low-level native machine code. This stage is known as just-in-time (JIT) compilation, and it takes place in the same way for all .NET applications (including Windows applications,for example).

Instead, the IL code is created once and regenerated only when the source is modified. Similarly, the native machine code files are cached in a system directory that has a path like c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.

■Note You might wonder why the temporary ASP.NET files are found in a directory with a 2.0 version number
rather than a 3.5 version number. Technically, ASP.NET 3.5 uses the ASP.NET 2.0 engine (with a few new features piled on).

Web Project VS. Web Site

The actual point where your code is compiled to IL depends on how you’re creating and deploying your web application. If you’re building a web project in Visual Studio, the code is compiled to IL when you compile your project. But if you’re building a lighterweight projectless website, the code for each page is compiled the first time you request that page. Either way, the code goes through its second compilation step (from IL to machine code) the first time it’s executed.

Fact 3: ASP.NET Is Multilanguage

Fact 4: ASP.NET Is Hosted by the Common Language Runtime

Fact 5: ASP.NET Is Object-Oriented

Html Server-Side Control VS. ASP.NET Web Control

  

<input type=button click=’’ runat=”server”/>  won’t cause page postback when the button is clicked.

  

Fact 6: ASP.NET Is Multidevice and Multibrowser

Although you can retrieve information about the client browser and its capabilities in an ASP.NET page, ASP.NET actually encourages developers to ignore these considerations and use a rich suite of web server controls.
These server controls render their HTML adaptively by taking the client’s capabilities into account.
One example is ASP.NET’s validation controls, which use JavaScript and DHTML (Dynamic HTML) to enhance their behavior if the client supports it. This allows the validation controls to show dynamic error messages without the user needing to send the page back to the server for more processing.
These features are optional, but they demonstrate how intelligent controls can make the most of cutting-edge browsers without shutting out other clients. Best of all, you don’t need any extra coding work to support both types of client.

Fact 7: ASP.NET Is Easy to Deploy and Configure

ASP.NET 3.5: The Story Continues

ASP.NET Major Release:

ASP.NET 1.0 ----> ASP.NET 1.1 --->  ASP.NET 2.0 ----> ASP.NET 3.5 ---> ASP.NET 4.0

  

ASP.NET 2.0 Highlights:

(1) More rich controls

(2) Master pages

(3) Themes

(4) Security and membership

(5) Data source controls

(6) Web parts

One common type of web application is the portal, which centralizes different information using separate panes on a single web page. Web parts provide a prebuilt portal framework complete with a flow-based layout, configurable views, and even drag-and-drop support.

(7) Profiles

This feature allows you to store user-specific information in a database without writing any database code. Instead, ASP.NET takes care of the tedious work of retrieving the profile data when it’s needed and saving the profile data when it changes.

The Provider Model

Many of the features introduced in ASP.NET 2.0 work through an abstraction called the provider model. The beauty of the provider model is that you can use the simple providers to build your page code. If your requirements change, you don’t need to change a single page—instead, you simply need to create a custom provider.

How about ASP.NET 3.0?

It doesn’t exist. Microsoft used the name .NET Framework 3.0 to release new technologies—most notably, WPF (Windows Presentation Foundation), a slick new user interface technology for building rich clients, WCF (Windows Communication Foundation), a technology for building message-oriented services, and WF (Windows Workflow Foundation), a technology that allows you to model a complex business process as a series of actions (optionally using a visual flowchart- like designer).

However, the .NET Framework 3.0 doesn’t include a new version of the CLR or ASP.NET. Instead, the next release of ASP.NET was rolled into the .NET Framework 3.5.

ASP.NET 3.5 Highlights

(1) LINQ

      LINQ to Objects /  LINQ to SQL / LINQ to XML

(2) ASP.NET AJAX

(3) Green Bits and Red Bits

Oddly enough, ASP.NET 3.5 doesn’t include a full new version of ASP.NET. Instead, ASP.NET 3.5 is designed as a set of features that add on to .NET 2.0.

The parts of .NET that haven’t changed in .NET 3.5 are often referred to as red bits, while the parts that have changed are called green bits.


The red bits include the CLR, the ASP.NET engine, and all the class libraries from .NET 2.0. In other words, if you build a new ASP.NET 3.5 application, it gets exactly the same runtime environment as an ASP.NET 2.0 application. Additionally, all the classes you used in .NET 2.0—including those for connecting to a database, reading and writing files, using web controls, and so on—remain the same in .NET 3.5.

The red bits also include the features that were included in .NET 3.0, such as WCF. All the assemblies in .NET 3.5 retain their original version numbers. That means .NET 3.5 includes a mix of 2.0, 3.0, and 3.5 assemblies. If you’re curious when an assembly was released, you simply need to check the version number.

When building an ASP.NET 3.5 application, you’ll use the C# 3.0 language compiler. It includes support for a few new features, most of which are required for LINQ. Figure 1-4 shows the collection of classes and components that comprise ASP.NET 3.5.

image

It’s important to understand the multilayered architecture of ASP.NET 3.5, because you’ll still see some of the fingerprints of past versions. For example, ASP.NET places temporary files and web server configuration files in subdirectories of the c:\Windows\Microsoft.NET\Framework\v2.0.50727 directory.

This is because ASP.NET 3.5 uses the ASP.NET 2.0 engine, and the final release version of ASP.NET 2.0 was v2.0.50727.

Silverlight

  

Silverlight, a new Microsoft technology that allows a variety of browsers on a variety of operating systems to run true .NET code. Silverlight works through a browser plug-in, and provides a subset of the .NET Framework class library. This subset includes a slimmed-down version of WPF, the technology that developers use to craft next-generation Windows user interfaces.

Simply, it allows you to create richer pages than you could with HTML, DHTML, and JavaScript alone. In many ways, Silverlight duplicates the features and echoes the goals of Adobe Flash. By using Silverlight in a web page, you can draw sophisticated 2D graphics, animate a scene, and play video and other media files.

In many respects, Silverlight is a complementary technology to ASP.NET. ASP.NET 3.5 doesn’t include any features that use Silverlight, but future versions of ASP.NET will.

原文地址:https://www.cnblogs.com/fangwenyu/p/1607706.html