Aspnet

ASP.NET is a new version of Microsoft's established ASP technology. It offers significant improvements over the original model.

An ASP is an HTML page that contains fragments of scripting language code in addition to HTML markup. When the page is accessed, the scripting code is executed, and the output from the code is sent to the client along with the rest of the HTML on the page. This mixture of fixed HTML and scripting code means that Web pages can be customized, with the code generating custom HTML based on user input.

ASP has been extremely popular, and many Web servers now use it to generate custom content, but it does have its drawbacks. ASP.NET has been designed to address these drawbacks:

■ In ASP, you're limited to using scripting languages, which in most cases means VBA or JScript. ASP.NET pages can now be written in any .NET language. So if you want to write ASP pages that use C++, C#, or even COBOL, you can.

■ The scripting code in ASP pages is interpreted, which doesn't provide the best performance. Code in ASP.NET pages is compiled rather than interpreted, leading to great improvements in performance. In addition, code only needs to be compiled once.

■ Code and HTML are intermixed in ASP pages, which makes pages hard to maintain as they get more complex. It is possible to separate the code and HTML using programming tricks, but it isn't supported in ASP itself. ASP.NET does support separation of the code from the HTML, maintaining the code in separate files. Because content and presentation is often developed by different people, separating the code aids the development of complex pages.

■ If you want ASP pages to target multiple browsers or device types, you have to do it manually. ASP.NET has built-in support for multiple client types, using a range of server-side controls that automatically adjust their presentation depending on the capability of different clients. This means that it is possible to write ASP.NET pages that will display properly—and automatically—on traditional browsers as well as WAP phones and other small devices.

Perhaps the most radical development in ASP.NET is the introduction of Web Services. A Web Service is an application that can be found and accessed through a Web server, so that programmable functionality can be accessed over networks and the Internet using standard protocols. Figure 1.2 shows the architecture of a Web Service, where a client talks to a server using standard Web protocols—XML over HTTP for those clients that support it and standard HTTP Get and Post requests for all other clients. The server maintains a directory of Web Services that clients can query in order to find out exactly what methods are available and how they should be called.

Figure 1.2: Web Service architecture

Any method in a .NET object (written, of course, in any .NET language) can be marked very simply as a Web method. The compiler and CLR make all the necessary arrangements, registering the method so that it can be used through a Web server. The implications of this for Web application developments are tremendous because Web sites and other applications will be able to communicate at the method level, sending queries, invoking operations, and exchanging data. Communication takes place in XML, so that it is possible to link diverse systems using Web Services. In fact, because Web Services are simply a way of discovering and calling methods remotely using XML as the data transfer medium, it is quite possible that you will see Web Services being written on non-Microsoft platforms that have nothing whatsoever to do with .NET.

Along with Web Services, ASP.NET introduces a new version of ADO called ADO.NET, which makes it much easier to work with disconnected data and uses XML as its main means of data transfer. Working mainly with disconnected datasets means that ADO.NET is more scalable than ADO because the database connection is only required for a short time while the dataset is acquired. Working with XML as the data transfer mechanism rather than COM's binary protocol means that it's going to be easier to work through firewalls.

0 0

Post a comment