Returning XML from an ASP Web page

Source: Internet
Author: User
Tags iis
Profile
Returning XML data from an Active Server pages (ASP) Web page is a common programming requirement.
The method used to implement this requirement varies depending on the version of Microsoft Internet Information Services (IIS) that is used to host the ASP application.
The step-by-Step guide In this article shows how to return Extensible Markup Language (XML) data from an ASP page with the relevant sample code.
The following example code creates an ASP page that returns the contents of an ActiveX data Objects (ADO) recordset in XML format.
This code connects to an instance of the SQL Server PUBS sample database, and it opens an ADO recordset by executing a SELECT query to retrieve data from the Authors table.
Then, using the Save feature of ADO and the Write method of the ASP Response object, this recordset is returned to the client browser in XML format.
1. Prerequisites
The following is a brief list of recommended hardware, software, network architectures, and required Service packs:
Microsoft Windows 2000 Professional, Windows Server, or Windows Advanced server
Microsoft Internet Information Server (IIS) 5.0
Or
Microsoft Windows NT 4.0 Server
Microsoft Internet Information Server (IIS) 4.0
2. Prepare the Web site
In Windows Explorer, create a folder named Xmltest in the root folder of the Web server (usually C:inetpubwwwroot).
Right-click the newly created folder, and then click Properties.
On the Security tab, add the Everyone group and grant Read and write permissions to the Everyone group for this folder. Click OK to accept the change.
On the Start menu, point to the program, point to Administrative Tools, and then click Internet Services Manager.
Under Internet Information Services, double-click to expand the entries that correspond to the local server.
Right-click Default Web site, point to New, and then click Virtual Directory.
In the wizard, follow these steps:
When prompted, type Xmltest in the virtual directory alias text box, and then click Next.
When you are prompted to type the content directory for your Web site, click Browse, select the newly created Xmltest directory, and then click Next.
When you are prompted to select access rights, select Read and run scripts (for example, ASP).
No additional access rights are required in this example. Click Next to complete the wizard.
Double-click Default Web site.
Right-click the new virtual directory, and then click Properties.
On the Table of Contents tab, check whether the name of the Web site (the name you typed in step 6 a) is listed in the Application Name text box below the application settings. If it is not listed, click Create to create the application.
Closes the Properties dialog box and IIS.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.