473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Return XML from ASPX page.

I tried the following to return an XML string, but it did not seem to return
XML

Any ideas?

Thanks in advance.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Response.ContentType = "text/xml"
Response.Write("<ReturnValue><GoodLogin>False</GoodLogin></ReturnValue>")

end sub
Nov 11 '05 #1
4 17902


Jim Mitchell wrote:
I tried the following to return an XML string, but it did not seem to return
XML

Any ideas?

Thanks in advance.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Response.ContentType = "text/xml"
Response.Write("<ReturnValue><GoodLogin>False</GoodLogin></ReturnValue>")

end sub


When I write a little C# example

<%@ Page Language="C#" %>
<script runat="server">
void Page_Load (object sender, System.EventArgs evt) {
Response.ContentType = "text/xml";
Response.Write("<gods><god name=\"Kibo\" /></gods>");
}
</script>

and load the page with Mozilla 1.4 then it recognizes it is an XML page
and pretty prints the XML structure. Only IE6 tries to be too clever I
think and does its usual content sniffing instead of expecting the
Content-Type header. However, if I use scripting in IE to load the aspx
page then it works e.g. with

var xmlDocument = new ActiveXObject('Msxml2.DOMDocument.4.0');
xmlDocument.async = false;
var loaded = xmlDocument.load('test20030810.aspx');
if (loaded) {
alert(xmlDocument.documentElement.nodeName);
}

the node name of the document element is alerted in a dialog box.

Thus I guess your problem is that IE is not rendering the XML as such. I
am currently clueless on how to achieve that.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 11 '05 #2
Martin Honnen wrote:
Thus I guess your problem is that IE is not rendering the XML as such. I
am currently clueless on how to achieve that.

In XSL-FO and PDF world there is old dirty trick how to force IE show
generated PDF - at the end of URL they add dummy parameter &dummy=foo.pdf to
make the URL looking like a link to static PDF file. Chances are the same will
work with XML files.

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #3


Oleg Tkachenko wrote:
Martin Honnen wrote:
Thus I guess your problem is that IE is not rendering the XML as such.
I am currently clueless on how to achieve that.


In XSL-FO and PDF world there is old dirty trick how to force IE show
generated PDF - at the end of URL they add dummy parameter
&dummy=foo.pdf to make the URL looking like a link to static PDF file.
Chances are the same will work with XML files.


Yes, if I load
http://localhost/javascript/test2003...e=whatever.xml
then IE is nice enough to render the XML. It would be nicer however if
IE would respect the HTTP Content-Type header

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 11 '05 #4
Hi,
Response.Write("<ReturnValue><GoodLogin>False</GoodLogin></ReturnValue>")


Try to append before this line the following one:

Response.Write("<?xml version='1.0'?>");

I hope this help.

--
______________________________
With best wishes, Arthur Nesterovsky
Please visit my home page:
http://www.nesterovsky-bros.com


Nov 11 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: nakhi | last post by:
Hi, I updated to aspx last three month,after developing serveral applications,Idecided to downgraded to asp, following is my reasons: 1.in ASPX,the page format is hard to control,in ASP u can...
2
by: Silvia | last post by:
Hi, I have aspx page, and this page go to another aspx i have that this second aspx return a image, how the first page can received the object system.drawing.image. My code is that: Private...
6
by: Bruce W.1 | last post by:
The intent of my web service is an RSS feed from a blog. Originally I used a StringBuilder to make the XML and returned a string from the webmethod. But this doesn't display properly in IE. So...
2
by: Kathy Burke | last post by:
I'm trying to use the following code to use a javascript return confirm. Cancel would exit the sub and return the page to its history (-2). OK would proceed with the asp.net code, i.e., run the...
2
by: kermit | last post by:
I have a .net aspx page MyPage.aspx (client side) with code behind MyPage.aspx.vb (server side). I use the Page_Load event in MyPage.aspx.vb to load data into a multiteir class based...
4
by: Mark S. | last post by:
Hello, On a high volume page we have the following JavaScript: img = new Image() img.src = 'http://myserver.com/count.aspx?x=1'; and it works fine, but now we've added: img.onload =...
0
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm using a URLRewrite module to redirect certain URLs in my .net 2.0 website. However I am getting som really bizarre behaviour public void UrlRewriter_BeginRequest(object sender,...
2
by: Dunc | last post by:
Has anyone got a way to get asp.net to return a result code of 404 with a friendly page of any substance? I have been trying to do a Server.Transfer from the global.asax.cs Application_Error...
5
by: TompIfe | last post by:
Hi, I have a web service that reads data from an Access database using datareader and place the data in an array that the web method returns. Now, I want to make the web service also to return an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.