> Try adding before Response.Binary Write(...) the line
Ya better write bit by bit
string _filePath = "..."
Response.Clear( );
Response.AddHea der("Content-Disposition", "inline");
Response.Conten tType = "applicatio n/pdf";
Response.Buffer = false;
FileStream _fileStream = null;
byte[] _buffer = new byte[1024];
long _byteCount;
try
{
_fileStream = File.OpenRead(_ filePath);
while ((_byteCount =
_fileStream.Rea d(_buffer, 0, _buffer.Length) ) > 0)
{
if(Response.IsC lientConnected)
{
Response.Output Stream.Write(
_buffer, 0, _buffer.Length) ;
Response.Flush( );
}
else
{
return;
}
}
}
catch(Exception _ex)
{
throw _ex;
}
finally
{
_fileStream.Clo se();
}
--Daniel
http://staff.newtelligence.com/danielf/
-----Original Message-----
From: Paul Henderson [mailto:pa****** *****@pittville .demon.co.uk]
Posted At: Monday, January 23, 2006 12:36 PM
Posted To: microsoft.publi c.dotnet.framew ork.aspnet
Conversation: File Open and Save dialog poping up while opening PDF
Subject: Re: File Open and Save dialog poping up while opening PDF
I am trying to display a PDF file (which I am being passed from a web
service as a binary stream) in a browser, but I am being prompted to
save the file instead. I don't want the user to be prompted; I just
want the PDF to be displayed.
Try adding before Response.Binary Write(...) the line
Response.AddHea der("Content-Disposition", "inline");
to tell the browser to show the document inline. Note however that the
problem *could* actually be on the client side, as Adobe Reader
sometimes refuses to show a PDF inline, even when the
content-disposition is set to 'inline'.