"Save as.." dialog reapears with Windows 2000

G

Guest

Hi,

In my web I have a proccess of download reports which on first step
generates a PDF, then flushes the buffer (the generated file) and finally
deletes this file from server. Ok, the problem is that using it with Windows
2000, when the "Save as..." dialog box appears and a user clicks "Open"
button, the dialog reappears and for opening the file it must be clicked
again. In fact the first dialog box shows a message more or less like this:
"Downloading mypage.aspx from www.mysite.com". So it looks like it were going
to download the page instead of the file.pdf. That's not a real problem
because finally the downloaded file is the PDF, but it's not very elegant.

In any case I don't want to force to W2000 users to click two times on
"open" button to open the PDF. Does anybody if this is a bug from W2000 or is
just my code that is not well typed? Here goes the code:

string guid = Report.CreateReport(parameters);
string localfile = Report.GetFile(guid);
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType="application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Regex.Replace(localfile, @"\\\\(\w)*\\(\w)*\\[\w{}-]+\\(?<Name>)*",
"${Name}"));
Response.WriteFile(localfile);
Response.Flush();
Report.DeleteReport(localfile);
Response.Close();

THANKS IN ADVANCE!!!
TOMAS.
 
G

Guest

Well, I have checked that in the following line if I remove "atachment; ",
in windows 2000 doesn't appears two times the dialog box, but in XP for
example it opens it directly on the browser... agghh.. :( Any idea?

Response.AddHeader("Content-Disposition", "attachment; filename=" +
Regex.Replace(localfile, @"\\\\(\w)*\\(\w)*\\[\w{}-]+\\(?<Name>)*",
"${Name}"));

THANKS AGAIN!
 

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