Quantcast
Channel: Creating an XML receive/send page
Viewing all articles
Browse latest Browse all 5

Re: Creating an XML receive/send page

$
0
0

Hi pcools.

pcools

I have created a page (and service). When our provider sends an xml, it seems I can receive it (the xml is stored on my server). However, the response.xml is not sent; our provider gets the well know error  system.xml.exception line 1,....-thing. I have looked at my response.xml with a HEX-editor, but there is no BOM in it.

According to your description, you could receive the request xml and store it on your server, but the response.xml is not sent, it is very much possible to write the content of an xml as the response of an ASP.NET page. Write the following code in the page load event of the file. 

    protected void Page_Load(object sender, EventArgs e)
        {

            this.Response.Clear();
            string respfilepath = @"C:\CRDC\Response.xml";

            this.Response.ContentType = "text/xml";
            Response.WriteFile(respfilepath);

       
            this.Response.Flush();

            this.Response.Close();


        }

If you only want XML content then make sure you delete html tags from the design and keep only the page attribute in the page. This will prevent the page from flushing out default html tags and viewstate.

Further further, if you want the XML file to actually be downloaded to the user's machine (the open/save/cancel dialog box) instead of showing it in the browser, then set the ContentType to "application/octet-stream".

http://forums.asp.net/t/1204802.aspx

I hope it's helpful to you.

Best Regards,

Klein zhang


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>