Coding viewData.asp

If the user fails authentication by Windows NT 4.0 or Windows 2000, the content of the variable AUTH_USER in the ServerVariables collection is blank. The string "401 Access Denied" is assigned to the Status property of the Response object and the browser knows the user has not been authenticated. Next the standard Windows NT or Windows 2000 logon dialog box appears and the user logs on. If the user is authenticated, access is granted to the PT application. Implementing a Trusted Connection in global.asa, Creating a Group Account for PT Administrators (Windows 2000), and Creating a Group Account for PT Administrators ( Windows NT 4.0) provide additional information about security in the PT application. The following code fragment shows how authentication is enforced:

If Request.ServerVariables("AUTH_USER") = "" Then
   Response.Status = "401 Access Denied"
   Response.End
End If

Because viewData.asp returns XML data, code must explicitly identify the ContentType of the Response object as shown in the following line of code:

Response.ContentType = "text/xml"

The following line of code indicates an XML document and specifies the version and encoding. The default encoding is UTF-8.

<?xml version="1.0" encoding="UTF-8" ?>

Next, viewData.asp instantiates SQLXML (an object in Litware.dll) and calls the ViewRecords method, passing ASP objects (Request, Response, and Server) and the "Eval_Connection" string of the Application object as parameters. The following code fragment illustrates this process:

Set objLitware = Server.CreateObject("Litware.SQLXML")
…
objLitware.ViewRecords Request,Response,Server,Application("Eval_ConnectionString")

Using ViewRecords to Retrieve Data as an XML Data Stream and ViewRecords: Where the Data Retrieval Process Begins further describe how XML data is returned to the browser.