By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,864 Members | 1,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,864 IT Pros & Developers. It's quick & easy.

Response.Write inserting extra

P: n/a
Hello,
I'm creating an .aspx page that gets an XML document (as a string) from a
server via .NET remoting and returns it in the Response.Write method.
I'm saving the document to a file before I return it from the server and it
looks good, well formed and all. But, when I use Explorer to hit the .aspx
page, it returns the document but sticks this in the document some place:
<SN>96620150</SN>
<< The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later.
Cannot have a DOCTYPE declaration outside of a prolog. Error processing
resource
'http://localhost/GetSpatialSearch/MySpatialSearch.aspx?layerName=centroid&s
n=98676052&format=xml'. Line 2, Position 11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
----------^
SPAN class="t">SN>96620066</SN>

The above text shows one of the elements (the <SN> element), then the error
text, then another element.

I'm doing a
Response.ContentType = "Text/XML";

prior to writing out to the Response object.
Anybody know how I can get rid of this or is it just and Internet Explorer
thing?

Thanks
Steve
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thu, 8 Jul 2004 15:22:28 -0700, "Steve" <sa****@home.com> wrote:
Hello,
I'm creating an .aspx page that gets an XML document (as a string) from a
server via .NET remoting and returns it in the Response.Write method.
I'm saving the document to a file before I return it from the server and it
looks good, well formed and all. But, when I use Explorer to hit the .aspx
page, it returns the document but sticks this in the document some place:
<SN>96620150</SN>
<< The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later.
Cannot have a DOCTYPE declaration outside of a prolog. Error processing
resource
'http://localhost/GetSpatialSearch/MySpatialSearch.aspx?layerName=centroid&s
n=98676052&format=xml'. Line 2, Position 11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
----------^
SPAN class="t">SN>96620066</SN>

The above text shows one of the elements (the <SN> element), then the error
text, then another element.

I'm doing a
Response.ContentType = "Text/XML";

prior to writing out to the Response object.
Anybody know how I can get rid of this or is it just and Internet Explorer
thing?

Thanks
Steve


Sounds like something is getting put into the response stream before
the xml document. Read through the code to find out why there are
elements being output before the actual XML document.

I successfully use this code to output an xml document to the page:

Response.Buffer = true;
Response.ContentType = "text/xml";
xReturn.LoadXml(sXML); // xreturn is an xmldocument.
xReturn.WriteTo(new System.Xml.XmlTextWriter(Response.Output));
Response.Flush();
Response.End();

Also, have you tested the XSL and verified it works?

-Adam
Nov 18 '05 #2

P: n/a

"Steve" <sa****@home.com> wrote in message news:OI**************@TK2MSFTNGP09.phx.gbl...
Hello,
I'm creating an .aspx page that gets an XML document (as a string) from a
server via .NET remoting and returns it in the Response.Write method.
I'm saving the document to a file before I return it from the server and it
looks good, well formed and all. But, when I use Explorer to hit the .aspx
page, it returns the document but sticks this in the document some place:
<SN>96620150</SN>
<< The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later.
Cannot have a DOCTYPE declaration outside of a prolog. Error processing
resource
'http://localhost/GetSpatialSearch/MySpatialSearch.aspx?layerName=centroid&s
n=98676052&format=xml'. Line 2, Position 11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
----------^
SPAN class="t">SN>96620066</SN>

The above text shows one of the elements (the <SN> element), then the error
text, then another element.

I'm doing a
Response.ContentType = "Text/XML";

prior to writing out to the Response object.
Anybody know how I can get rid of this or is it just and Internet Explorer
thing?

Thanks
Steve


Did you remove everything (except the <%@ Page %> directive) from the aspx
page? It sound as if that is sent along with the xml document.

The file you write out, does it look good to your eyes, or is it also possible
to open it in IE (use .xml extension)?
What does "View Source" in IE on the (partially) displayed aspx look like?

Hans Kesting
Nov 18 '05 #3

P: n/a
Okay, there was something in the .aspx page. I totally forgot about that. I
just removed everything except the @Page directive and all seems well now.
Thanks very much for your help Hans.

Steve
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:OJ**************@TK2MSFTNGP11.phx.gbl...

"Steve" <sa****@home.com> wrote in message news:OI**************@TK2MSFTNGP09.phx.gbl...
Hello,
I'm creating an .aspx page that gets an XML document (as a string) from a server via .NET remoting and returns it in the Response.Write method.
I'm saving the document to a file before I return it from the server and it looks good, well formed and all. But, when I use Explorer to hit the ..aspx page, it returns the document but sticks this in the document some place: <SN>96620150</SN>
<< The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
Cannot have a DOCTYPE declaration outside of a prolog. Error processing
resource
'http://localhost/GetSpatialSearch/MySpatialSearch.aspx?layerName=centroid&s n=98676052&format=xml'. Line 2, Position 11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
----------^
SPAN class="t">SN>96620066</SN>

The above text shows one of the elements (the <SN> element), then the error text, then another element.

I'm doing a
Response.ContentType = "Text/XML";

prior to writing out to the Response object.
Anybody know how I can get rid of this or is it just and Internet Explorer thing?

Thanks
Steve


Did you remove everything (except the <%@ Page %> directive) from the aspx
page? It sound as if that is sent along with the xml document.

The file you write out, does it look good to your eyes, or is it also

possible to open it in IE (use .xml extension)?
What does "View Source" in IE on the (partially) displayed aspx look like?

Hans Kesting

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.