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.
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.