Content-Disposition starts a new session

A

Anonymous Poster

hi,

I'm having a serious issue with the VS 2003 / 1.1 framework and attachments.
If I try to prompt to open/save a file with the following

public void WriteBinaryResponse(HttpResponse aResponse, string aContentType,
byte[] aData, string aDefaultFileName)
{
aResponse.ClearContent();
if (aDefaultFileName != null)
aResponse.AppendHeader("Content-Disposition","attachment;filename=\""+aDefaultFileName+"\"");
aResponse.AppendHeader("Content-Length", aData.Length.ToString());
aResponse.ContentType = aContentType;
aResponse.BinaryWrite(aData);
aResponse.Flush();
aResponse.Close();
}

then on next PostBack, a new Session is created! Can't find any solutions on
google etc. :( Also (randomly) selecting 'open' comes up with 'file not
found'. I read that this can sometimes happen due to caching, but I'm not
setting any cachability on the page...

TIA

Simon
 
A

Anonymous Poster

Anyone?? (apologies for double post - msimn screwed up..)

I've since tried the following -

1) Moving the code to do the export to a new web application and using a
webserver caching method to retrieve the report data
2) Saving the document on the server and providing a simple link to the
generated file

Method 1 gets around the 'file not found' issue but the new session problem
remains.
Method 2 seems to allow opening the file to work ok, but saving the file
this time causes the new session bug.

This issue is a obviously a showstopper for our clients!

Simon
 

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

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top