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