ASP generating XML prompts save with query string


N

nbarwig

Hello, I have an issue I am having difficulty diagnosing..

In short, I have a asp page that generates only xml output for use
with an ajax application. On the last step of my process a simple xml-
word document is generated and displayed in a new window (or iframe).
The asp document is called with several querystring elements to
produce the document.

In IE7, when the document is returned from the server a Open/Save
dialog is presented. Here is where things get weird.. Occasionally the
filename will appear as expected, 'callproc.xml', however the majority
of the time the filename will appear as '...param1=00000&param2=abcd'.
This causes IE to fail opening or saving the document.

The XML being generated is valid and when saved will open with Word as
expected without error. I have also defined the content-type as text/
xml.

Questions:
1. How can I consistently get the returned xml document to appear
correctly without the querystring as part of the file name?
2. Is there anyway to avoid the Open/Save dialog when requesting an
XML document?

Any help on this will be greatly appreciated!
 
Ad

Advertisements

A

Anthony Jones

Hello, I have an issue I am having difficulty diagnosing..

In short, I have a asp page that generates only xml output for use
with an ajax application. On the last step of my process a simple xml-
word document is generated and displayed in a new window (or iframe).
The asp document is called with several querystring elements to
produce the document.

In IE7, when the document is returned from the server a Open/Save
dialog is presented. Here is where things get weird.. Occasionally the
filename will appear as expected, 'callproc.xml', however the majority
of the time the filename will appear as '...param1=00000&param2=abcd'.
This causes IE to fail opening or saving the document.

The XML being generated is valid and when saved will open with Word as
expected without error. I have also defined the content-type as text/
xml.

Questions:
1. How can I consistently get the returned xml document to appear
correctly without the querystring as part of the file name?

Response.AddHeader "Content-Disposition", "filename=Whatever.xml"
2. Is there anyway to avoid the Open/Save dialog when requesting an
XML document?

You might try a different content type with a view to getting MS Word to
accept and handle the stream. Try application/vnd.ms-word.main+xml
 
N

nbarwig

Response.AddHeader "Content-Disposition", "filename=Whatever.xml"


You might try a different content type with a view to getting MS Word to
accept and handle the stream. Try application/vnd.ms-word.main+xml

Thanks for the reply Anthony!

Here is the header I am producing.. I had thought of the content-
disposition, but it has made no difference.

Response.ContentType = "text/xml"
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Content-Disposition", "filename=callproc.xml"
 
A

Adrienne Boswell

Gazing into my crystal ball I observed (e-mail address removed) writing in
Thanks for the reply Anthony!

Here is the header I am producing.. I had thought of the content-
disposition, but it has made no difference.

Response.ContentType = "text/xml"
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Content-Disposition", "filename=callproc.xml"

What about content type?
 
A

Anthony Jones

Thanks for the reply Anthony!

Here is the header I am producing.. I had thought of the content-
disposition, but it has made no difference.

Response.ContentType = "text/xml"
Response.Expires = 0
Response.Expiresabsolute = Now() - 1

Both of these set the Expires headers, use only 1 not both. Now() - 1 is
fairly good if you really want the content to expire.
Response.AddHeader "pragma","no-cache"

Technically this can appear in a response but it is primarily used in
requests, I'd remove it.
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"

The CacheControl property sets the Cache-Control header so only use that
there is no need to attemtp to Add the cache control header yourself. Try:-

Response.CacheControl = "private; no-cache; max-age=0"

for a belts and braces header.
Response.AddHeader "Content-Disposition", "filename=callproc.xml"

That looks good.

The only reason I can think of that would cause you to not always see this
filename is because the content is not being re-fetched from the server.
When IE re-uses content it already has it doesn't honor the
Content-Disposition header.
 
Ad

Advertisements

N

nbarwig

Both of these set the Expires headers, use only 1 not both. Now() - 1 is
fairly good if you really want the content to expire.


Technically this can appear in a response but it is primarily used in
requests, I'd remove it.


The CacheControl property sets the Cache-Control header so only use that
there is no need to attemtp to Add the cache control header yourself. Try:-

Response.CacheControl = "private; no-cache; max-age=0"

for a belts and braces header.


That looks good.

The only reason I can think of that would cause you to not always see this
filename is because the content is not being re-fetched from the server.
When IE re-uses content it already has it doesn't honor the
Content-Disposition header.

You rock Anthony. Thank you for you're responses. I took another
approach to generate the end document. Instead of writing a purely XML
word doc I just changed the header to be "word" and now write it out
in HTML which is much easier then pure XML :-D

Thanks alot, very helpful!
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top