Click here to Skip to main content
15,888,610 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Deleting is not supported by data source 'SqlDataSource1' unless DeleteCommand is specified. Pin
Licky Nguyen22-Jul-09 1:02
Licky Nguyen22-Jul-09 1:02 
QuestionAnchror tag probelm Pin
indian1436-Jul-09 19:17
indian1436-Jul-09 19:17 
Questiondynamically added checkbox doesn't fire the event. Pin
prasadbuddhika6-Jul-09 19:06
prasadbuddhika6-Jul-09 19:06 
AnswerRe: dynamically added checkbox doesn't fire the event. Pin
N a v a n e e t h6-Jul-09 20:21
N a v a n e e t h6-Jul-09 20:21 
Questiondetect bluetooth device Pin
nithydurai6-Jul-09 19:04
nithydurai6-Jul-09 19:04 
AnswerRe: detect bluetooth device Pin
Abhijit Jana6-Jul-09 19:10
professionalAbhijit Jana6-Jul-09 19:10 
QuestionS/MIME Emails Pin
g00fyman6-Jul-09 18:37
g00fyman6-Jul-09 18:37 
QuestionIIS7 with ASP.NET + Response.OutputStream.Write does not work in IE7 and IE8 Pin
kent856-Jul-09 15:46
kent856-Jul-09 15:46 
Hi all.

So here is my problem. The application is hosted in Windows Server 2008 with IIS7.

I have a button (from Silverlight page) that calls a new webpage (asp.net page, ext .aspx) that contains Response.OutputStream.Write(blahblahblah) which then should prompt a download box to allow user to save an image.

Now the page basically creates a stream and then is supposed to output the stream to the user using Response.Outputstream.Write.

Then the user is supposed to be prompted to open or save the document. This works fine in Firefox but it does not work with IE7 or 8

Also this exact same code works with IIS6 on a Windows 2003 server.

So the only differences is the IIS6 and Windows 2003 Server to IIS7 and Windows 2008 Server.

And what happens is when I clicked the button, the page did pop up but disappear 1-2 seconds later without prompting the download box to the user.

Here is the code that launches for Reference

//e.g file = 123424_43535.jpeg
FileInfo myFile = new FileInfo(Server.MapPath("mapImage/") + file;
using(var fs = myFile.Open(FileMode.Open, FileAccess.Read))
{
byte[] buffer;
int read;
buffer = new byte[(int)fs.Length];

Response.AddHeader("Content-Disposition", "attachment;filename=" + file);
Response.ContentType = "application/x-force-download";
Response.AddHeader("Connection", "Keep-Alive");
Response.AddHeader("Content-Length", fs.Length.ToString());
while((read = fs.Read(buffer, 0, buffer.Length)) > 0)
{
this.Response.OutputStream.Write(buffer, 0, read);
}
}
Response.End();

I have tried to replace Response.AddHeader with Response.AppendHeader, however the result is still the same.
Also, I have tried to replace the Response.ContentType with application/octet-stream and image/jpeg, I also faced the same result.

Is there any setting/modification on server/code that I need to look on?

This problem has bugged me for a long period and a quick reply/solution will be very much appreciated.

Thanks and have a nice day.

Regards,
Kent
Questionbuttonfield, onclick (change text) Pin
mark_me6-Jul-09 13:22
mark_me6-Jul-09 13:22 
Questionhelp upload file problem Pin
my30name6-Jul-09 11:43
my30name6-Jul-09 11:43 
Questionhow can I create custom dropdownlist ( inherited from standard dropdownlist) with 4 default items? Pin
mehran.asg6-Jul-09 8:38
mehran.asg6-Jul-09 8:38 
AnswerRe: how can I create custom dropdownlist ( inherited from standard dropdownlist) with 4 default items? Pin
Manas Bhardwaj6-Jul-09 10:23
professionalManas Bhardwaj6-Jul-09 10:23 
GeneralRe: how can I create custom dropdownlist ( inherited from standard dropdownlist) with 4 default items? Pin
mehran.asg6-Jul-09 19:08
mehran.asg6-Jul-09 19:08 
GeneralRe: how can I create custom dropdownlist ( inherited from standard dropdownlist) with 4 default items? Pin
mehran.asg6-Jul-09 19:09
mehran.asg6-Jul-09 19:09 
Questionwant some help on my website Pin
Abdulhafeezo6-Jul-09 7:27
Abdulhafeezo6-Jul-09 7:27 
AnswerRe: want some help on my website Pin
Sandeep Akhare6-Jul-09 8:04
Sandeep Akhare6-Jul-09 8:04 
JokeRe: want some help on my website Pin
Abhijit Jana6-Jul-09 8:21
professionalAbhijit Jana6-Jul-09 8:21 
AnswerRe: want some help on my website Pin
Manas Bhardwaj6-Jul-09 10:24
professionalManas Bhardwaj6-Jul-09 10:24 
AnswerRe: want some help on my website Pin
J4amieC6-Jul-09 23:45
J4amieC6-Jul-09 23:45 
QuestionParsing Large XML File Pin
Tiger4566-Jul-09 6:53
Tiger4566-Jul-09 6:53 
AnswerRe: Parsing Large XML File Pin
Sandeep Akhare6-Jul-09 8:03
Sandeep Akhare6-Jul-09 8:03 
GeneralRe: Parsing Large XML File Pin
Tiger4566-Jul-09 17:37
Tiger4566-Jul-09 17:37 
GeneralRe: Parsing Large XML File Pin
Jimmy Zhang21-Nov-09 11:18
Jimmy Zhang21-Nov-09 11:18 
QuestionI intend to Pin
Abdulhafeezo6-Jul-09 4:11
Abdulhafeezo6-Jul-09 4:11 
AnswerRe: I intend to Pin
ScottM16-Jul-09 4:29
ScottM16-Jul-09 4:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.