|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Opening a file from pdf in ieI 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 > I have a small webpage that reads a file from sql server 2000 database and It depends to some extent on what the browser chooses to do, but try> 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? 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.
Other interesting topics
Session state IIS (Machine Key | Load Balanced Session)
New to ASP Is this AJAX? (Sort of "Off Topic") Convert New Lines to BRs Translating ID bound to label in detailsView to NAME basing on different datasource. hidden fields? Anyone care to help explain forms authentication in 2.0? ASP.NET: Can't Kill EXCEL.exe with Office PIA Update Query in formview Parsing Request.Headers.ToString() |
|||||||||||||||||||||||