Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / January 2006

Tip: Looking for answers? Try searching our database.

How to Return pure XML (no WS)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stefano Peduzzi - 31 Jan 2006 10:16 GMT
Hi,
I've to return an XML (a KML for Google Earth) from my Web Server. How can I
do it with ASP.NET 2.0???
These are the requirements for a "KML Server" as stated by Google:
KML Server requirements
When responding to a request from the Google Earth client, a KML server must
follow a certain set of rules so that the client can correctly interpret
responses.

Upon success, the server must return a response code of HTTP 200 and set the
response's content-type to a suitable MIME type.
Google Earth reads KML and KMZ files, and the MIME types for these are:
application/vnd.google-earth.kml+xml kml
application/vnd.google-earth.kmz kmz
The body of the response must contain valid KML data, including the xml
declaration header (<?xml version="1.0" encoding="UTF-8"?>). If the server
returns invalid KML, the Network Link will stop deactivate and output an
error message.

Thanks,
Stefano
Matt Dinovo - 31 Jan 2006 15:15 GMT
Create an HttpHandler that sets the Response.ContentType to the proper MIME
type and does a Response.Write of the output xml.

HTH,

Matt Dinovo

> Hi,
> I've to return an XML (a KML for Google Earth) from my Web Server. How can
[quoted text clipped - 17 lines]
> Thanks,
> Stefano
Peter Bromberg [C# MVP] - 31 Jan 2006 15:19 GMT
Response.ContentType="application/vnd.google-earth.kml+xml kml";
XmlDocument doc = new XmlDocument();
doc.LoadXml("your Xml document string here"); // or use doc.Load overload
Response.Write (doc.OuterXml);
Response.End();

Peter

Signature

Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

> Hi,
> I've to return an XML (a KML for Google Earth) from my Web Server. How can I
[quoted text clipped - 17 lines]
> Thanks,
> Stefano
Joerg Jooss - 31 Jan 2006 21:41 GMT
Hello Stefano,

> Hi,
> I've to return an XML (a KML for Google Earth) from my Web Server. How
[quoted text clipped - 21 lines]
> an
> error message.

The best approach is to implement a HttpHandler that sets HttpResponse.ContentType
to one of those mentioned above and writes KML to your HttpResponse's OutputStream.
There's really nothing special here.

Cheers,
Signature

Joerg Jooss
news-reply@joergjooss.de


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.