By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,915 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,915 IT Pros & Developers. It's quick & easy.

"Save as.." dialog reapears with Windows 2000

P: n/a
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.
Jun 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

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!
"Tomas Martinez" wrote:
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.

Jun 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.