Chapter 19: Advancements for Common Web Scenarios
The ability of Web applications for allowing businesses to maintain data and services in a central location while also permitting access from anywhere in the world, makes them a highly popular type of application. This chapter presents some suggestions for possible .NET Web application advancements, focusing on AS.NET features and Web services that will enable you to make your applications usable over the Web.
What are some key features of ASP.NET?
- ASP.NET provides a model that enables Web developers to write logic that runs at the application level. Developers can write this code in the Global.asax text file or in a compiled class deployed as an assembly. This logic can include application- level events, but developers can easily extend this model to suit the needs of their Web application.
- ASP.NET provides application and session-state facilities.
- For advanced developers who want to use APIs as powerful as the ISAPI programming interfaces that were included with previous versions of ASP, ASP.NET offers the IHttpHandler and IHttpModule interfaces. Implementing the IHttpHandlerinterface gives you a means of interacting with the low-level request and response services of the IIS Web server and provides functionality much like ISAPI extensions, but with a simpler programming model.
- All ASP.NET code is compiled instead of interpreted, which allows early binding, strong typing, and just-in-time (JIT) compilation to native code. ASP.NET is also easily factorable, which means that developers can remove modules (for example, a session module) that are not relevant to the application that they are developing.
- ASP.NET offers the TraceContext class, which allows you to write custom debug statements to your pages as you develop them. They appear only when you have enabled tracing for a page or an entire application. Enabling tracing also appends details about a request to the page, or, if you specify, to a custom trace viewer that is stored in the root directory of your application.
- The .NET Framework and ASP.NET provide default authorization and authentication schemes for Web applications. You can easily remove, add to, or replace these schemes, depending on the needs of your application.
- ASP.NET configuration settings are stored in XML-based files, which are human readable and writable. Each of your applications can have a distinct configuration file and you can extend the configuration scheme to suit your requirements.
What kind of features and tools does ASP.NET incorporates to design high-performance web applications?
- A process model that has improvements over the model in ASP.
- A feature that automatically detects changes in ASP.NET pages, dynamically compiles changed pages, and stores the newly compiled files for reuse in subsequent requests.
- ASP.NET-specific performance counters.
- Web application testing tools.
What are the two main enhancements in ASP.NET involved in processing HTTP requests?
- When an ASP.NET page is requested for the first time, an instance of the Page class is dynamically compiled. In earlier versions of ASP, page code was interpreted for requests in the order that they appeared on the page. The common language runtime JIT compiles ASP.NET managed page code to the native code of the processing server at run time.
- When the Page instance has been compiled for the first request, it is cached on the server. For each subsequent request for that page, the cached instance of the class is executed. After the initial request, the Page class is recompiled only when the original source for the page or one of its dependencies has changed.
How do master pages work in ASP.NET?
They enable you to apply the same page layout to multiple content pages in a Web application. A master page is essentially astandard ASP.NET page except that it uses the extension of .master and a <%@ master %> directive instead of <%@ page %>. This master page file serves as the template for other pages, so typically it will contain the top-level HTML elements, the main form, headers, footers, and such.
What functions do HTTP modules serve?
- Modules enable developers to intercept, participate in, or modify each individual request.
- Modules implement the IHttpModule interface, which is located in the System.Web namespace.
How can I create an HTTP module?
To create an HTTP module, you must implement the IHttpModule interface. The IHttpModule interface has two methods that include the following signatures.
The Init method is called when the module attaches itself to the HttpApplication object and Dispose is called when the module is detached from HttpApplication. The Init and Dispose methods represent the module’s opportunity to hook into a variety of events that are exposed by HttpApplication.
What is the definition of a Web service?
There is not a universal definition of a Web service or a minimum standard for the requirements and services offered by one. What is commonly accepted is that a Web service is a software system that is designed to support interactions between different computers in a network.
What are some important features of a Web service?
- A publicly exposed interface with all of the members that can be accessed by a client application or component. This interface can be described in a standard language by using an XML format. The Web Service Description Language (WSDL) is the most widely accepted language for this purpose.
- A mechanism to publish the services offered by a component that can be located by parties who are interested in the service provided. The most accepted directory of Web services that are currently available is Universal Description, Discovery, and Integration (UDDI).
What benefits are provided by Web services technology, from a business point of view?
- Improved customer satisfaction because of new opportunities to access up-todate information.
- Increased sales by improvements to the process of online purchases.
- Decreased costs by reducing the burden of excess calls on phone centers.
- Shared information between store locations and businesses.
Why are the new Web services so important in the software industry?
The answer to that question involves standardization. With new standards, such as XML and SOAP, you can set the foundation for several platforms and communicate between them. Today, software components can communicate with peers by using a structured language (XML) and through SOAP.
What are the most commonly used standards used in Web services today?
Emerging standards. These include:
- XML agreements for industry data exchange.
- Security. This includes authentication (Microsoft WS-Security is an example).
- Transactions. This includes management of a set of interdependent actions (XAML and OASIS BTP are examples).
- Processes. This includes complex business interactions descriptions (Microsoft’s WS-Routing is an example).
Existing standards. These include:
- SOAP. This protocol requests a Web service.
- Web Service Description Language (WSDL). This is a standard for documenting what a Web service does and how to use it
- Universal Description, Discovery, and Integration (UDDI). This is a standard for listing WSDL documents in a directory for automatic search.
Established standards. These include:
- Transmission Control Protocol/Internet Protocol (TCP/IP). This is an Internet network protocol.
- Hypertext Transfer Protocol (HTTP). This protocol is used to transfer data between serves and clients in hypertext/hypermedia.
- File Transfer Protocol (FTP). This method moves files between two Internet sites.
- Simple Mail Transfer Protocol (SMTP). This protocol is used for sending electronic mail messages between computers.
- Uniform Resource Identifier (URI). This method is used to identify any point of content on the web, whether it is a page of text, a video or sound clip, a still or animated image, or a program.
- XML standard for exchanging data.
How can I add a Web service to my application?
Follow these steps:
- Open the client application.
- On the Project menu, click Add Web Reference.
- In the Add Web Reference dialog box, click Web services on the local machine.
- In the list of available Web services, click Service1.
- In the text box labeled Web service name, enter a name for this new reference. For this example enter HelloWorldWS. You will use this name to refer to the Web service from the Visual Basic .NET code.
- Click on the Add Reference button.
What technology updates are available through Web services?
Web Services Enhancements (WSE)
The Web Services Enhancements (WSE) is a .NET class library that augments the .NET Framework and related technologies to provide an implementation of various Web service specifications. WSE is designed to simplify the development and deployment of secure Web services by helping Visual Studio .NET and .NET
- Web Services Security: WS-Security is not a complete security solution in and of itself. It is a protocol for exchanging security information between message senders and receivers. Developers need to design an appropriate security solution and deal with potential threats, such as replay attacks.
- Attachments: WSE 2.0 supports attaching files to SOAP messages outside the SOAP envelope; these files are not serialized as XML. This can be beneficial when sending large text or binary files because XML serialization is a very costly process and can result in files much larger than the originals. Direct Internet Message Encapsulation (DIME) is a lightweight, binary message format that WSE 2.0 uses to encapsulate SOAP messages and their attachments in a single message.
- WS-Routing: WS-Routing is a specification used by participants in a service network to move messages from a source to a destination. WS-Routing is the heart of a SOAP router, which often acts as an intermediary, passing information between SOAP routers and to other service network participants.