Functional Interoperabaility ASP Help

As the client transition from stand-alone applications to browser-based interfaces occurred. another factor came into interoperability. IT departments have struggled with interoperability ever since programming escaped the confines of the mainframe. As the number of computers and computing devices within the business and entertainment worlds expanded. the problem grew. Today. computing is no longer limited to ful.1- size desktop machines or even laptops. Handheld and notepad computers. telephones. and even pagers communicate with the Web servers and need to display data-sometimes even display the same data or run the same application as a desktop box. Similarly.IT departments now run critical applications on mainframes. minicomputers and several different types of servers from small departmental servers to server farms that supply computing power to the entire enterprise and beyond. These servers are made by different vendors and often run differing and incompatible operating systems. yet companies often need to transport and consume data between the ..arious machines, databases. application tiers, and clients.Companies have attacked the interoperability problem in several ways. They’ve tried limiting the hardware and software-crearing tight corporate standards for desktop. laptop. and handheld computers. That approach hasn’t worked very weU-the industry changes too fast. They’ve tried and discarded the thin-client network computer approach. Too little benefit. too late. They’ve tried implementing Java as both the platform and the language–bllt performance iSsues.a lack of cooperation between the major software suppliers, and lack of commercial-quality software have–at least remporarily– quelled that approach as well. Fortunately. a new interoperability standard has recently presented itself-XML.

Standardization Verifiability and HTTPAffinity

XML provides a possible solution to some of these interoperability problems. XML is not a panacea but it does provide a standardized and text-based file format that can help ease the problems involved in moving data from one server to another. as well as accommodate displaying identical data on disparate clients.XMVs standardization helps. because the Iile format is universally recognizc:J.XML simplifies programming because it can verify.by using a (DID) or that-a file does indeed contain a specific type of content. Finally. XML’s text-based format transfers very well over a plain HTTP connection. which helps avoid problems with firewalls and malicious code.

Web Services

These attributes. standardization. verifiability and HITP affinity. led to a new use for ASP–creating server-based code that delivers data without necessarily delivering HTML In .NET such pages are called Web Services.You can think of a Web Service as a function call or as an object instantiation and method call across the Web. Just asWeb browsers and Web servers use a common protocol. HTTP. to communicate across the network. aWeb Service uses a common XML structure. called Simple Object Access Protocol (SOAP) to communicate with the calling application. you will learn more about SOAP and Web Services in Chapter 21.

What Does ASP.NET Do?

What does ASP.NET do? Again. this is not a simple question. Classic ASP was limited to simple script languages that cduld respond to requests. but provided no intrinsic direct access to sys~cmservices other than those few required to read and respond to a request. such as.writing output text. While you could extend classic ASP through commercial or custom-built COM components. the l’Clatively high overhead required to create COl\1 objects. and classic ASP’s reliance on untyped interpreted scripting languages.limited system performance. In contrast. creating .NET framework objects requires very little overhead. and ASP.NET lets you use fully object-oriented Ian~ges with seamless access to system services.Therefore. I’ll describe just the primacy tasks that ASP.NET accomplishes now. and then fill in the practical details in the remainder of this book

Accepts Requests

All ASP.NET pages work essentially the same way.A client application makes at HTTP request to aWeb server using a URL The Web server hands off the request to the ASP.NET processor. which parses the URL and all data sent by the client into collections of named values. ASP.NET exposes these values as properties of an object called the Http Request object. which is a member of the
System. Net assembly.An assembly is a collection of classes. Although an assembly “,n be a DLL. it may consist of more than one DLL Conversely. a single DLL may contain more than one assembly. For now. think oftan assembly as a group of related classes. When a browser. or more properly a makes a request. it sends a string containing type and version information along with the request. You can retrieve the HTTP_USER..AGENT string via the Http Request object. For example the following code fragment retrieves several items from the user

Just as ASP.NET abstracts incoming data in the HttpRequest object, it provides a way to respond to the rrquest via the HttpResponse object. Abstracting responses in this manner has been 50 successful that you’U find you need to know almost nothing about HlTP itself to use the HttpRequest and HttpResponse objects.

Assists with State Maintenance

Unlike a stand-alone or standard client-server application Web applications are “stateless which means that neither the client nor the server “remembers” each other after a complete request/response cycle for a single page completes. Each page requested is a complete and isolated transaction which works fine for browsing static HTML pages but is the single largest problem in constructing Web applications.

Classic ASP introduced the idea of a session which begins the first time a client requests any page in your application. At that point the ASP engine created-a unique cookie, which the browser then accepted and returned to the server for each subsequent page request. ASP used the cookie value as a pointer No data saved for that particular client in an object called the Session object. Unfortunately because the client data was stored in memory on a single server this scheme did not scale well nor was it fault-tolerant. If the Web server went down the users lost the in-memory data.

ASP.NET uses much the same cookie scheme to identify specific clients but the equivalent of the Session object is now called the Http Session State object. ASP.NET addresses the session-scalability and data-vulnerability problems in classic ASP by separating state maintenance &om the ASP.NET engine. ASP.NET has a second server application, called the Session server to manage session data. You can run the Session server in or out of the lIS process on the same machine as your Web server or out of process on a separate computer. Running it on a separate computer lets you maintain a single Session store across multiple Web servers. ASP.NET also adds the option to maintain state in SQL Server which increases fault tolerance in case the Session server fails.

Why Is ASP.NET in a VB.NET Book?

VB6 had a project type called an lIS Application-a technology more commonly known as Web classes. 1 wrote a book about using WebClasses, caUed the ~l &sit Dtwloper’s Guill, to ASP MIll lIS (Sybex, 1999). Using WebClasses, aVB programmer had access to the ASP intrinsic objects- Request Response Server Application and Session–end could use the compiled code within Web- Oasses to respond to client Web requests. But lIS Applications required ASP to be installed on the server and in fact were called as COM components from an automatically generated ASP page. Therefore a WebClass-based application inVB6 was really an ASP application that followed a ‘specific track to instantiate and use VB COM components. Although the entire underlying technology has changed that aspect has not.

TIP

VB.NET Web application project is an ASP.NET application

ASP.NET. although advertised as if it werea separate technology is not. It is part of. and completely dependent on the .NET framework. (see Figure 4.1). In fact, an ASP.NET project is owtly tht SImIt tbing as a VB.NETWcb Application project. You’ll hear that you can write an ASP.NET application wing Notepad-and you canlYou can also write a VBNET application wing Notepad. But the big advantage of writing aVB.NET application within the Visual Studio NET (VS.NET) IDE is that you have access to a number of productivity tools including syntax highlighting. IntelliSen.se macros and add-ins the ToolBox, HTML XML code editors the Server Explorer etc. etc. etc. Remember that when you create aV8.NETWeb Application project, you’re really crea,ringan project-you’re jwt approaching the technology through a specific language and IDE.