I try to send an xml from an aspx pages which generate an xml file. And I tried with this method

Z

zoltix

Hello,

I try to send an xml from an aspx pages which generate an xml file.
And I tried with this method


FileStream fs = new
FileStream(WebSdxResponse.file_path,FileMode.Open,FileAccess.Read,FileSh
are.None);
byte[] b = ReadFully(fs,(int) fs.Length);Response.Clear();
Response.ContentType= “text/xml”;
Response.AppendHeader("content-disposition","attachement;filename=test.x
ml");
Response.OutputStream.Write(b,0,b.Length);
Response.End();
Response.Close();


Orig: xml format, I sure the xml format is well formatted.

In my Internet explorer, I have some extra characters (_ViewState, html
tags…). But when I change the ContentType(“blabla/bXml”) and change
filename to test.Dxml. It works well.


Could help me to send an xml page well formatted in internet explorer?
 
H

Hans Kesting

zoltix said:
Hello,

I try to send an xml from an aspx pages which generate an xml file.
And I tried with this method


FileStream fs = new
FileStream(WebSdxResponse.file_path,FileMode.Open,FileAccess.Read,FileSh
are.None);
byte[] b = ReadFully(fs,(int) fs.Length);Response.Clear();
Response.ContentType= "text/xml";
Response.AppendHeader("content-disposition","attachement;filename=test.x
ml");
Response.OutputStream.Write(b,0,b.Length);
Response.End();
Response.Close();


Orig: xml format, I sure the xml format is well formatted.

In my Internet explorer, I have some extra characters (_ViewState,
html tags.). But when I change the ContentType("blabla/bXml") and
change filename to test.Dxml. It works well.


Could help me to send an xml page well formatted in internet explorer?

You are sending this from the codebehind of an aspx page?
Did you clear all html code out of that aspx file?

By the way, the content-disposition is "attachment", in your post you
add en extra "e" in the middle (might be a typo in the post)

Hans Kesting
 
Z

zoltix

zoltix said:
Hello,

I try to send an xml from an aspx pages which generate an >xml file.
And I tried with this method


FileStream fs = new

FileStream(WebSdxResponse.file_path,FileMode.Open,FileAccess.Read,FileS h
are.None);
byte[] b = ReadFully(fs,(int) fs.Length);Response.Clear();
Response.ContentType= "text/xml";

Response.AppendHeader("content-disposition","attachement;filename=test. x
ml");
Response.OutputStream.Write(b,0,b.Length);
Response.End();
Response.Close();


Orig: xml format, I sure the xml format is well formatted.

In my Internet explorer, I have some extra characters >(_ViewState,
html tags.). But when I change the >ContentType("blabla/bXml") and
change filename to test.Dxml. It works well.


Could help me to send an xml page well formatted in >internet explorer?
You are sending this from the codebehind of an aspx page?
Did you clear all html code out of that aspx file?
By the way, the content-disposition is "attachment", in >your post you
add en extra "e" in the middle (might be a typo in the >post)
Hans Kesting






In fact, it is a button on my Aspx page which generates a stream. This
issue is only with the xml format. For a others format, they work well
(Exe,Zip….). I am going to try to add an aspx page just for the
downloading and I hope that I will resolve my problem


But I don’t understand why with the xml formats(Ext(.xml) or
Type(Text/Xml)) only, it don’t work?

Thank a lot
 
Top