Opening a file from pdf in ie

J

Joris De Groote

Hi,

I have a small webpage that reads a file from sql server 2000 database and
opens it (added the code at the end of this question). Everything works, but
the file opens adobe acrobat reader in a new application. However, I want to
open the file in ie, so I don't get another box and everything.
How can I do this?

Thanks Joris


Private Sub DocumentOpenen()
Dim connectionString As String = "Server=VHTI2006\VHTITEST;Initial
Catalog=STS_VHTI2006_1_21001;Trusted_Connection=True"
Dim strSQL As String = "SELECT Content from Docs where LeafName ='" &
Documentnaam & "'"
Dim cnnDatabase As New SqlConnection(connectionString)
Dim myCommand As SqlCommand = New SqlCommand(strSQL, cnnDatabase)
Try
myCommand.CommandTimeout = 500
cnnDatabase.Open()
Dim dreader As SqlDataReader = myCommand.ExecuteReader()
If (dreader.Read()) Then
Response.ContentType = "application/pdf"
Response.BinaryWrite(dreader("Content"))
End If
Catch ex As Exception
Me.Label1.Text = ex.ToString
Finally
cnnDatabase.Close()
End Try
 
P

Paul Henderson

I have a small webpage that reads a file from sql server 2000 database and
opens it (added the code at the end of this question). Everything works, but
the file opens adobe acrobat reader in a new application. However, I want to
open the file in ie, so I don't get another box and everything.
How can I do this?

It depends to some extent on what the browser chooses to do, but try
adding the header Content-Disposition: inline; to your response and see
if that helps. This question has been asked more than once before in
this group; you could try searching through past topics to see how
other people resolved this.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top