Asp. NET tip: Issues to be noted with ASPX output XML

Source: Internet
Author: User
Tags format contains
Asp.net|xml| Skills | questions

In an AJAX application, if the server side uses ASPX to return XML format data, it typically clears the VS-generated HTML character Fuxian, using Response.Write Output XML strings directly in the code file.

Note that the appropriate property client to set response can parse the string correctly.

To set the ContentType property first:

Response.ContentType = "Text/xml";

If the XML string contains Chinese, you also set the CharSet property:

Response.Charset = "GB2312";

Then output the content in the format of the XML file:

Response.Write ("<?xml version=\" 1.0\ "encoding=\" gb2312\ "?>");

Today is because of this charset let me depressed for a long time, because the XML character contains Chinese characters and did not set the charset, so xmlhttprequest.responsexml is always null, after half a day of information finally dawned.



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.