KML file appears as aspx when served

S

Simon

I have a .Net C Sharp page (aspx) serving up as a .kml file. On my localhost
and an internal test server the page serves correctly and opens Google
Earth. On my production server, I am served the aspx file.

I don't have kml in the MIME types on any of the servers and was wondering
what the difference could be and where I might need to look for differences
in the servers? (The production and test servers are on Win2003 and my
localhost XPsp2)

I am changing the header to
Response.ContentType="application/vnd.google-earth.kml+xml kml";

Response.AddHeader("Content-Disposition","inline;filename=location.kml");

and outputting the following

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>
<name>Casualty Location for PRESTIGE</name>
<visibility>1</visibility>
<description>

</description>
<LookAt>
<longitude>-9.85000000</longitude>
<latitude>43.01666667</latitude>
<range>50000</range>
<tilt></tilt>
<heading>0</heading>
</LookAt>
<styleUrl>#khStyle651</styleUrl>
<Point>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>-9.85000000,43.01666667,0</coordinates>
</Point>
</Placemark>
</kml>

Cheers!
 
D

Daniel Crichton

Simon wrote on Fri, 24 Mar 2006 10:04:50 -0000:
I have a .Net C Sharp page (aspx) serving up as a .kml file. On my
localhost and an internal test server the page serves correctly and opens
Google Earth. On my production server, I am served the aspx file.

I don't have kml in the MIME types on any of the servers and was wondering
what the difference could be and where I might need to look for
differences in the servers? (The production and test servers are on
Win2003 and my localhost XPsp2)

I am changing the header to
Response.ContentType="application/vnd.google-earth.kml+xml kml";

Response.AddHeader("Content-Disposition","inline;filename=location.kml");

Have you tried enclosing the filename in quotes, as per the RFC?

Response.AddHeader("Content-Disposition","inline;filename=""location.kml""");

There are also apparently at least six possible variants depending on the
browser version:

http://www.aspfaq.com/show.asp?id=2129

You might want to experiment with a few till you find the right one. Also,
it's possible that there is a difference in the way IE handles sites in the
Intranet/Trusted Sites Zones and the Internet Zone. Try adding your
production server URL to the Trusted Sites zone - if it works then IE
doesn't like the inline; for Internet Zone downloads, you might have better
luck with trying attachment; instead.

Dan
 
S

Simon

Daniel said:
Simon wrote on Fri, 24 Mar 2006 10:04:50 -0000:
There are also apparently at least six possible variants depending on
the browser version:

http://www.aspfaq.com/show.asp?id=2129

You might want to experiment with a few till you find the right one.
Also, it's possible that there is a difference in the way IE handles
sites in the Intranet/Trusted Sites Zones and the Internet Zone. Try
adding your production server URL to the Trusted Sites zone - if it
works then IE doesn't like the inline; for Internet Zone downloads,
you might have better luck with trying attachment; instead.


Thanks for the pointers, Dan
 
Top