Home All Groups Group Topic Archive Search About

Response.AddHeader("Content-Disposition"....

Author
7 Sep 2006 7:37 AM
Trapulo
I've this statement in my output's creation:

Response.Clear()

Response.ContentType = "application/vnd.google-earth.kml+xml kml"

Response.AddHeader("Content-Disposition", "inline; filename=Log_" &
activityLogID & ".kml")

The strage is that on my development server all works (IE try to open the
file with GE, and if I force it to save the file when I click on the link,
it prompts for "Log_....." file name). But on production server, IE doesn't
recognize MIME type, and if I force it to save the file, it prompts for the
original aspx's file name.
Firefox works well on all two servers. Where is the error?

thanks

Author
7 Sep 2006 1:12 PM
Steven Cheng[MSFT]
Hello Trapulo,

From your description, you're using ASP.NET page to flush out some google
earth map file and let the client-side choose the google earth, however,
you found this works when running the application on development server but
not work when running on a production server ,correct?

As for the different behavior, are you getting them on the same client
machine when visiting the server page or just test locally on each server? 
I would recommend you try different remote client machine to see whether
you'll get different behavior.

Based on my experience, the client-side browser's behavior against handling
different mime-type is depend on its internal implementation. For IE, you
can have a look at the following msdn article:

#MIME Type Detection in Internet Explorer
http://msdn.microsoft.com/workshop/networking/moniker/overview/appendix_a.as
p?frame=true

And if the problem is specific to server, you can check the registered
mime-type in IIS 6's service manager(see my attached screenshot in this
message).  You need to select the topest(machine) node in IIS manager and
right click to choose "properties" menu.

and as for the filename problem, what's the behevior if you choose the code
as below:

========================
Response.ClearHeaders();
Response.ClearContent();

Response.ContentType = "application/vnd.google-earth.kml+xml kml"

Response.AddHeader("Content-Disposition", "attachment; filename=Log_" &
activityLogID & ".kml")

===================

this will always prompt for file open or save.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
Are all your drivers up to date? click for free checkup

Author
8 Sep 2006 10:03 AM
Trapulo
"Steven Cheng[MSFT]" <stch***@online.microsoft.com> wrote in message
news:haJRQ9n0GHA.228@TK2MSFTNGXA01.phx.gbl...
> Hello Trapulo,
>
> From your description, you're using ASP.NET page to flush out some google
> earth map file and let the client-side choose the google earth, however,
> you found this works when running the application on development server
> but
> not work when running on a production server ,correct?

yes

> As for the different behavior, are you getting them on the same client
> machine when visiting the server page or just test locally on each server?
> I would recommend you try different remote client machine to see whether
> you'll get different behavior.

I try from the same machine, that is also the development server. I've also
tried from other machines, but only calling the production server, and I
have the same behavior.

> Based on my experience, the client-side browser's behavior against
> handling
> different mime-type is depend on its internal implementation. For IE, you
> can have a look at the following msdn article:
>
> #MIME Type Detection in Internet Explorer
> http://msdn.microsoft.com/workshop/networking/moniker/overview/appendix_a.as
> p?frame=true

I think the problem can be here:
"If a positive match is found (one of the hard-coded tests succeeded), this
MIME type is immediately returned as the final determination, overriding the
server-provided MIME type (this type of behavior is necessary to identify a
..gif file being sent as text/html). During scanning, it is determined if the
buffer is predominantly text or binary."

maybe IE scan content, and see that it is an xml file. So it shows it as
xml, ignoring mime directive. If this can explain the problem (and then I
don't know how to solve it because this is xml, but IE may open with right
viewer), this doesn't explain why calling the page on the production server
works.

> And if the problem is specific to server, you can check the registered
> mime-type in IIS 6's service manager(see my attached screenshot in this
> message).  You need to select the topest(machine) node in IIS manager and
> right click to choose "properties" menu.

Yes, I know this. But if I am generating the kml format from aspx, I think
that MIME types are unuseful, aren't them? In fact, either on my development
server I cannot find a setting related to this format. The only difference
between two servers is that the development one has google earth installed,
but I think it's strange it can change IIS behavor..

Show quoteHide quote
> and as for the filename problem, what's the behevior if you choose the
> code
> as below:
>
> ========================
> Response.ClearHeaders();
> Response.ClearContent();
>
> Response.ContentType = "application/vnd.google-earth.kml+xml kml"
>
> Response.AddHeader("Content-Disposition", "attachment; filename=Log_" &
> activityLogID & ".kml")
>
> ===================
>
> this will always prompt for file open or save.

I try this, however my requirenment is to open direct the file and not to
save it. However, it can be an acceptable tradeoff if this can work with IE
also, and not with firefox.

thanks
Author
11 Sep 2006 11:24 AM
Steven Cheng[MSFT]
Thanks for your reply Trapulo,

If you get the different results on the same client machie against
differetn target server. It is still likely the response stream contains
different content/headers. As for those IIS server mime-type setting,
they're actually read from the server machine's registry. Also, you
mentioned that the difference between the two servers is that development
server has google earch installed while the deployment machine not, you can
check whether the mime-type lists on the two machines also vary.

For general testing, I think you can try put a static kml file in IIS
virual diretory and use browser to navigate to it to see how the client
browser process it. You can also use some network trace tools to capture
the http response stream of the two different response(correct and
incorrect) to see what's the difference in the raw response.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

Bookmark and Share