![]() |
|
|
|||||||
![]() |
ASP Net - Using BinaryWrite to output PDF to IE |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hi,
I've created a small application for our company extranet (staff bulletins) that outputs a list of links to PDF's that are stored in a SQL table. The user clicks a link and the PDF is loaded into a new browser window. This works as expected on the test PC (using forms authentication, but no SSL) using IE. It also works as expected on the production server when using FireFox. The production server environment is using forms authentication and SSL. However the PDF load fails when using IE as the browser to access the production server (which my users/staff colleagues will be doing). I have also tested it without using SSL or Forms authentication by putting it on our public site on the production server. This also means you can (temporarily) see the problem for yourself at: www.copeohs.com/ebulletins/bulletins.aspx The error seems to be generated by Adobe Reader rather than specifically IE, but as the system works using FireFox, I am guessing it is the relationship between IE and Adobe Reader that is the problem? The Adobe Reader error message provided is: "There was an error opening this document. This file is already open or in use by another application." I am using VB.NET 1.1 on IIS 6 (win 2003 svr). Code snippet that outputs the PDF from the DB: -------------------------------------------------------- 'The required file ID comes from the querystring. If Me.Request.IsAuthenticated Then If Request.QueryString.Count <> 0 Then 'Get the (pdf) filename to display Me.FileID = CInt(Request.QueryString("doc").ToString) Dim ds As New DataSet Dim PDFfileSize As Long Dim db As Database = DatabaseFactory.CreateDatabase Dim cmd As DBCommandWrapper = db.GetStoredProcCommandWrapper("usp_Bulletin_Singl e_SELECT") cmd.AddInParameter("@BID", DbType.Int32, Me.FileID) Try Me.lblErr.Visible = False 'Load the record (PDF file) into local dataset db.LoadDataSet(cmd, ds, "theBulletin") 'Resize the byte array for file PDFfileSize = CLng(ds.Tables("theBulletin").Rows(0).Item("BFile" ).length) Dim thePDF(CInt(PDFfileSize)) As Byte 'Put the PDf into the byte array thePDF = ds.Tables("theBulletin").Rows(0).Item("BFile") 'Send the file to the output stream Response.BufferOutput = True 'Try and ensure the browser always opens the file and doesn't just prompt to "open/save". Response.AddHeader("Content-Disposition", "inline") 'Set the output stream to the correct content type (PDF). Response.ContentType = "application/pdf" 'Output the file Response.BinaryWrite(thePDF) thePDF = Nothing Catch ex As Exception Me.lblErr.Visible = True Me.lblErr.Text = ex.Message.ToString Finally 'Tidy memory ds = Nothing cmd = Nothing db = Nothing End Try End If Else Response.Redirect("/logon/applist.aspx") End If -------------------------------------------------------- I would greatly appreciate any help/ideas offered...thanks in advance. Al Alec MacLean |
|
|
|
|
#2 |
|
Posts: n/a
|
It didn't fail on this client. Are you sure that the Adobe acrobat reader
was installed on the machine on which it failed? Can you describe in detail what you mean by "failed?" -- HTH, Kevin Spencer Microsoft MVP Professional Numbskull Show me your certification without works, and I'll show my certification *by* my works. "Alec MacLean" <> wrote in message news:... > Hi, > > I've created a small application for our company extranet (staff > bulletins) > that outputs a list of links to PDF's that are stored in a SQL table. The > user clicks a link and the PDF is loaded into a new browser window. > > This works as expected on the test PC (using forms authentication, but no > SSL) using IE. It also works as expected on the production server when > using FireFox. The production server environment is using forms > authentication and SSL. > > However the PDF load fails when using IE as the browser to access the > production server (which my users/staff colleagues will be doing). > > I have also tested it without using SSL or Forms authentication by putting > it on our public site on the production server. > This also means you can (temporarily) see the problem for yourself > at: www.copeohs.com/ebulletins/bulletins.aspx > > The error seems to be generated by Adobe Reader rather than specifically > IE, > but as the system works using FireFox, I am guessing it is the > relationship > between IE and Adobe Reader that is the problem? > > The Adobe Reader error message provided is: > "There was an error opening this document. This file is already open or > in > use by another application." > > I am using VB.NET 1.1 on IIS 6 (win 2003 svr). > > Code snippet that outputs the PDF from the DB: > -------------------------------------------------------- > 'The required file ID comes from the querystring. > If Me.Request.IsAuthenticated Then > If Request.QueryString.Count <> 0 Then > 'Get the (pdf) filename to display > Me.FileID = CInt(Request.QueryString("doc").ToString) > Dim ds As New DataSet > Dim PDFfileSize As Long > Dim db As Database = DatabaseFactory.CreateDatabase > Dim cmd As DBCommandWrapper = > db.GetStoredProcCommandWrapper("usp_Bulletin_Singl e_SELECT") > cmd.AddInParameter("@BID", DbType.Int32, Me.FileID) > > Try > Me.lblErr.Visible = False > 'Load the record (PDF file) into local dataset > db.LoadDataSet(cmd, ds, "theBulletin") > > 'Resize the byte array for file > PDFfileSize = > CLng(ds.Tables("theBulletin").Rows(0).Item("BFile" ).length) > Dim thePDF(CInt(PDFfileSize)) As Byte > > 'Put the PDf into the byte array > thePDF = ds.Tables("theBulletin").Rows(0).Item("BFile") > > 'Send the file to the output stream > Response.BufferOutput = True > > 'Try and ensure the browser always opens the file and doesn't just > prompt to "open/save". > Response.AddHeader("Content-Disposition", "inline") > > 'Set the output stream to the correct content type (PDF). > Response.ContentType = "application/pdf" > > 'Output the file > Response.BinaryWrite(thePDF) > > thePDF = Nothing > > Catch ex As Exception > Me.lblErr.Visible = True > Me.lblErr.Text = ex.Message.ToString > > Finally > 'Tidy memory > ds = Nothing > cmd = Nothing > db = Nothing > End Try > > End If > Else > Response.Redirect("/logon/applist.aspx") > End If > -------------------------------------------------------- > > I would greatly appreciate any help/ideas offered...thanks in advance. > > Al > > > Kevin Spencer |
|
|
|
#3 |
|
Posts: n/a
|
Hi Kevin,
Thanks for your feedback. You don't mention your OS/browser versions - this might help me a bit. I know it works when using Firefox. Yes, Adobe Reader (v.7) is installed on all the machines accessing the pages. The Adobe Reader error message provided is: "There was an error opening this document. This file is already open or in use by another application." I've been searching further afield and note that a few people have logged similar problems, particularly for PDF output. One suggestion is to alter the metabase.xml file to allow greater sizes of AspBufferingLimit, e.g. set it to "2000000000" (2Gb). However, the test files I'm using are only in the 85Kb range, so clearly shouldn't be a problem for the default limit of 4Mb. Interestingly, the XP PC I'm using to develop on doesn't have a metabase.xml - presumably one of the differences between the versions of IIS for XP and Windows Server 2003. Al "Kevin Spencer" <> wrote in message news:... > It didn't fail on this client. Are you sure that the Adobe acrobat reader > was installed on the machine on which it failed? Can you describe in > detail what you mean by "failed?" > > -- > HTH, > > Kevin Spencer > Microsoft MVP > Professional Numbskull > > Show me your certification without works, > and I'll show my certification > *by* my works. > > "Alec MacLean" <> wrote in message > news:... >> Hi, >> >> I've created a small application for our company extranet (staff >> bulletins) >> that outputs a list of links to PDF's that are stored in a SQL table. >> The >> user clicks a link and the PDF is loaded into a new browser window. >> >> This works as expected on the test PC (using forms authentication, but no >> SSL) using IE. It also works as expected on the production server when >> using FireFox. The production server environment is using forms >> authentication and SSL. >> >> However the PDF load fails when using IE as the browser to access the >> production server (which my users/staff colleagues will be doing). >> >> I have also tested it without using SSL or Forms authentication by >> putting >> it on our public site on the production server. >> This also means you can (temporarily) see the problem for yourself >> at: www.copeohs.com/ebulletins/bulletins.aspx >> >> The error seems to be generated by Adobe Reader rather than specifically >> IE, >> but as the system works using FireFox, I am guessing it is the >> relationship >> between IE and Adobe Reader that is the problem? >> >> The Adobe Reader error message provided is: >> "There was an error opening this document. This file is already open or >> in >> use by another application." >> >> I am using VB.NET 1.1 on IIS 6 (win 2003 svr). >> >> Code snippet that outputs the PDF from the DB: >> -------------------------------------------------------- >> 'The required file ID comes from the querystring. >> If Me.Request.IsAuthenticated Then >> If Request.QueryString.Count <> 0 Then >> 'Get the (pdf) filename to display >> Me.FileID = CInt(Request.QueryString("doc").ToString) >> Dim ds As New DataSet >> Dim PDFfileSize As Long >> Dim db As Database = DatabaseFactory.CreateDatabase >> Dim cmd As DBCommandWrapper = >> db.GetStoredProcCommandWrapper("usp_Bulletin_Singl e_SELECT") >> cmd.AddInParameter("@BID", DbType.Int32, Me.FileID) >> >> Try >> Me.lblErr.Visible = False >> 'Load the record (PDF file) into local dataset >> db.LoadDataSet(cmd, ds, "theBulletin") >> >> 'Resize the byte array for file >> PDFfileSize = >> CLng(ds.Tables("theBulletin").Rows(0).Item("BFile" ).length) >> Dim thePDF(CInt(PDFfileSize)) As Byte >> >> 'Put the PDf into the byte array >> thePDF = ds.Tables("theBulletin").Rows(0).Item("BFile") >> >> 'Send the file to the output stream >> Response.BufferOutput = True >> >> 'Try and ensure the browser always opens the file and doesn't just >> prompt to "open/save". >> Response.AddHeader("Content-Disposition", "inline") >> >> 'Set the output stream to the correct content type (PDF). >> Response.ContentType = "application/pdf" >> >> 'Output the file >> Response.BinaryWrite(thePDF) >> >> thePDF = Nothing >> >> Catch ex As Exception >> Me.lblErr.Visible = True >> Me.lblErr.Text = ex.Message.ToString >> >> Finally >> 'Tidy memory >> ds = Nothing >> cmd = Nothing >> db = Nothing >> End Try >> >> End If >> Else >> Response.Redirect("/logon/applist.aspx") >> End If >> -------------------------------------------------------- >> >> I would greatly appreciate any help/ideas offered...thanks in advance. >> >> Al >> >> >> > > Alec MacLean |
|
|
|
#4 |
|
Posts: n/a
|
Hi Alec,
I was able to duplicate the problem by making multiple requests for the file with multiple browser instances. I'm running XP/IE 6, BTW. I was able to reproduce the problem on both IE and FireFox. The error is coming from the Acrobat Reader, alright. I can only guess at the cause, as it doesn't give any additional information, or log the error. You may want to contact their support group. -- HTH, Kevin Spencer Microsoft MVP Professional Numbskull Show me your certification without works, and I'll show my certification *by* my works. "Alec MacLean" <> wrote in message news:... > Hi Kevin, > > Thanks for your feedback. You don't mention your OS/browser versions - > this might help me a bit. I know it works when using Firefox. > > Yes, Adobe Reader (v.7) is installed on all the machines accessing the > pages. > > The Adobe Reader error message provided is: > "There was an error opening this document. This file is already open or > in use by another application." > > I've been searching further afield and note that a few people have logged > similar problems, particularly for PDF output. > > One suggestion is to alter the metabase.xml file to allow greater sizes of > AspBufferingLimit, e.g. set it to "2000000000" (2Gb). > However, the test files I'm using are only in the 85Kb range, so clearly > shouldn't be a problem for the default limit of 4Mb. > > Interestingly, the XP PC I'm using to develop on doesn't have a > metabase.xml - presumably one of the differences between the versions of > IIS for XP and Windows Server 2003. > > Al > > > > "Kevin Spencer" <> wrote in message > news:... >> It didn't fail on this client. Are you sure that the Adobe acrobat reader >> was installed on the machine on which it failed? Can you describe in >> detail what you mean by "failed?" >> >> -- >> HTH, >> >> Kevin Spencer >> Microsoft MVP >> Professional Numbskull >> >> Show me your certification without works, >> and I'll show my certification >> *by* my works. >> >> "Alec MacLean" <> wrote in message >> news:... >>> Hi, >>> >>> I've created a small application for our company extranet (staff >>> bulletins) >>> that outputs a list of links to PDF's that are stored in a SQL table. >>> The >>> user clicks a link and the PDF is loaded into a new browser window. >>> >>> This works as expected on the test PC (using forms authentication, but >>> no >>> SSL) using IE. It also works as expected on the production server when >>> using FireFox. The production server environment is using forms >>> authentication and SSL. >>> >>> However the PDF load fails when using IE as the browser to access the >>> production server (which my users/staff colleagues will be doing). >>> >>> I have also tested it without using SSL or Forms authentication by >>> putting >>> it on our public site on the production server. >>> This also means you can (temporarily) see the problem for yourself >>> at: www.copeohs.com/ebulletins/bulletins.aspx >>> >>> The error seems to be generated by Adobe Reader rather than specifically >>> IE, >>> but as the system works using FireFox, I am guessing it is the >>> relationship >>> between IE and Adobe Reader that is the problem? >>> >>> The Adobe Reader error message provided is: >>> "There was an error opening this document. This file is already open or >>> in >>> use by another application." >>> >>> I am using VB.NET 1.1 on IIS 6 (win 2003 svr). >>> >>> Code snippet that outputs the PDF from the DB: >>> -------------------------------------------------------- >>> 'The required file ID comes from the querystring. >>> If Me.Request.IsAuthenticated Then >>> If Request.QueryString.Count <> 0 Then >>> 'Get the (pdf) filename to display >>> Me.FileID = CInt(Request.QueryString("doc").ToString) >>> Dim ds As New DataSet >>> Dim PDFfileSize As Long >>> Dim db As Database = DatabaseFactory.CreateDatabase >>> Dim cmd As DBCommandWrapper = >>> db.GetStoredProcCommandWrapper("usp_Bulletin_Singl e_SELECT") >>> cmd.AddInParameter("@BID", DbType.Int32, Me.FileID) >>> >>> Try >>> Me.lblErr.Visible = False >>> 'Load the record (PDF file) into local dataset >>> db.LoadDataSet(cmd, ds, "theBulletin") >>> >>> 'Resize the byte array for file >>> PDFfileSize = >>> CLng(ds.Tables("theBulletin").Rows(0).Item("BFile" ).length) >>> Dim thePDF(CInt(PDFfileSize)) As Byte >>> >>> 'Put the PDf into the byte array >>> thePDF = ds.Tables("theBulletin").Rows(0).Item("BFile") >>> >>> 'Send the file to the output stream >>> Response.BufferOutput = True >>> >>> 'Try and ensure the browser always opens the file and doesn't just >>> prompt to "open/save". >>> Response.AddHeader("Content-Disposition", "inline") >>> >>> 'Set the output stream to the correct content type (PDF). >>> Response.ContentType = "application/pdf" >>> >>> 'Output the file >>> Response.BinaryWrite(thePDF) >>> >>> thePDF = Nothing >>> >>> Catch ex As Exception >>> Me.lblErr.Visible = True >>> Me.lblErr.Text = ex.Message.ToString >>> >>> Finally >>> 'Tidy memory >>> ds = Nothing >>> cmd = Nothing >>> db = Nothing >>> End Try >>> >>> End If >>> Else >>> Response.Redirect("/logon/applist.aspx") >>> End If >>> -------------------------------------------------------- >>> >>> I would greatly appreciate any help/ideas offered...thanks in advance. >>> >>> Al >>> >>> >>> >> >> > > Kevin Spencer |
|
|
|
#5 |
|
Posts: n/a
|
It worked for me as well. Running XP Pro SP2 with all security
updates. Adobe 7.0 and IE version 6 (6.0.2900.2180.xpsp_sp2_gdr.050301-1519 to be exact). Hope this helps you find your problem. And it also worked for me via FireFox. Well after I typed that I clicked on your link again and got the error that you received. Unfortunately I don't have any suggestions on how to resolve the problem at the moment. I do have an observation. The pdf opened in FireFox while I got an external reader window and a blank browser screen via IE. Perhaps a client side process isn't being cleaned up? Gozirra |
|
|
|
#6 |
|
Posts: n/a
|
Hi Alec,
In my guess, it seems that you open pdf file then write to browser. But you forget to close the pdf file. Because I can open it in the first time. Then no matter I use IE, Firefox, or NS, I cannot open it any more. HTH Elton Wang "Alec MacLean" wrote: > Hi Kevin, > > Thanks for your feedback. You don't mention your OS/browser versions - this > might help me a bit. I know it works when using Firefox. > > Yes, Adobe Reader (v.7) is installed on all the machines accessing the > pages. > > The Adobe Reader error message provided is: > "There was an error opening this document. This file is already open or > in use by another application." > > I've been searching further afield and note that a few people have logged > similar problems, particularly for PDF output. > > One suggestion is to alter the metabase.xml file to allow greater sizes of > AspBufferingLimit, e.g. set it to "2000000000" (2Gb). > However, the test files I'm using are only in the 85Kb range, so clearly > shouldn't be a problem for the default limit of 4Mb. > > Interestingly, the XP PC I'm using to develop on doesn't have a > metabase.xml - presumably one of the differences between the versions of IIS > for XP and Windows Server 2003. > > Al > > > > "Kevin Spencer" <> wrote in message > news:... > > It didn't fail on this client. Are you sure that the Adobe acrobat reader > > was installed on the machine on which it failed? Can you describe in > > detail what you mean by "failed?" > > > > -- > > HTH, > > > > Kevin Spencer > > Microsoft MVP > > Professional Numbskull > > > > Show me your certification without works, > > and I'll show my certification > > *by* my works. > > > > "Alec MacLean" <> wrote in message > > news:... > >> Hi, > >> > >> I've created a small application for our company extranet (staff > >> bulletins) > >> that outputs a list of links to PDF's that are stored in a SQL table. > >> The > >> user clicks a link and the PDF is loaded into a new browser window. > >> > >> This works as expected on the test PC (using forms authentication, but no > >> SSL) using IE. It also works as expected on the production server when > >> using FireFox. The production server environment is using forms > >> authentication and SSL. > >> > >> However the PDF load fails when using IE as the browser to access the > >> production server (which my users/staff colleagues will be doing). > >> > >> I have also tested it without using SSL or Forms authentication by > >> putting > >> it on our public site on the production server. > >> This also means you can (temporarily) see the problem for yourself > >> at: www.copeohs.com/ebulletins/bulletins.aspx > >> > >> The error seems to be generated by Adobe Reader rather than specifically > >> IE, > >> but as the system works using FireFox, I am guessing it is the > >> relationship > >> between IE and Adobe Reader that is the problem? > >> > >> The Adobe Reader error message provided is: > >> "There was an error opening this document. This file is already open or > >> in > >> use by another application." > >> > >> I am using VB.NET 1.1 on IIS 6 (win 2003 svr). > >> > >> Code snippet that outputs the PDF from the DB: > >> -------------------------------------------------------- > >> 'The required file ID comes from the querystring. > >> If Me.Request.IsAuthenticated Then > >> If Request.QueryString.Count <> 0 Then > >> 'Get the (pdf) filename to display > >> Me.FileID = CInt(Request.QueryString("doc").ToString) > >> Dim ds As New DataSet > >> Dim PDFfileSize As Long > >> Dim db As Database = DatabaseFactory.CreateDatabase > >> Dim cmd As DBCommandWrapper = > >> db.GetStoredProcCommandWrapper("usp_Bulletin_Singl e_SELECT") > >> cmd.AddInParameter("@BID", DbType.Int32, Me.FileID) > >> > >> Try > >> Me.lblErr.Visible = False > >> 'Load the record (PDF file) into local dataset > >> db.LoadDataSet(cmd, ds, "theBulletin") > >> > >> 'Resize the byte array for file > >> PDFfileSize = > >> CLng(ds.Tables("theBulletin").Rows(0).Item("BFile" ).length) > >> Dim thePDF(CInt(PDFfileSize)) As Byte > >> > >> 'Put the PDf into the byte array > >> thePDF = ds.Tables("theBulletin").Rows(0).Item("BFile") > >> > >> 'Send the file to the output stream > >> Response.BufferOutput = True > >> > >> 'Try and ensure the browser always opens the file and doesn't just > >> prompt to "open/save". > >> Response.AddHeader("Content-Disposition", "inline") > >> > >> 'Set the output stream to the correct content type (PDF). > >> Response.ContentType = "application/pdf" > >> > >> 'Output the file > >> Response.BinaryWrite(thePDF) > >> > >> thePDF = Nothing > >> > >> Catch ex As Exception > >> Me.lblErr.Visible = True > >> Me.lblErr.Text = ex.Message.ToString > >> > >> Finally > >> 'Tidy memory > >> ds = Nothing > >> cmd = Nothing > >> db = Nothing > >> End Try > >> > >> End If > >> Else > >> Response.Redirect("/logon/applist.aspx") > >> End If > >> -------------------------------------------------------- > >> > >> I would greatly appreciate any help/ideas offered...thanks in advance. > >> > >> Al > >> > >> > >> > > > > > > > =?Utf-8?B?RWx0b24gVw==?= |
|
|
|
#7 |
|
Posts: n/a
|
In case anyone was monitoring this thread...
I have managed to create a work-around. In my original version, I was setting the target of the link to the display aspx as "_new". (This is a hyperlink control set as a template column on a datagrid). By removing this target option (leaving it blank) and setting the output header for "Content-Disposition" to "attachment" instead of "inline", I now get the prompt from Adobe Reader to Open or Save the target PDF. I no longer get the blank IE window at all. While not my original intention, this is close to my desired aim and at least is more intuitive to use for my end-users than having two windows pop up with one (the IE window) being empty. The menu of PDF's remains in the background, and the Adobe Reader floats wherever they want it. Close the reader and they still have the pdf list. Al "Kevin Spencer" <> wrote in message news:e8Xz$... > Hi Alec, > > I was able to duplicate the problem by making multiple requests for the > file with multiple browser instances. I'm running XP/IE 6, BTW. I was able > to reproduce the problem on both IE and FireFox. The error is coming from > the Acrobat Reader, alright. I can only guess at the cause, as it doesn't > give any additional information, or log the error. You may want to contact > their support group. > > -- > HTH, > > Kevin Spencer > Microsoft MVP > Professional Numbskull > > Show me your certification without works, > and I'll show my certification > *by* my works. > > "Alec MacLean" <> wrote in message > news:... >> Hi Kevin, >> >> Thanks for your feedback. You don't mention your OS/browser versions - >> this might help me a bit. I know it works when using Firefox. >> >> Yes, Adobe Reader (v.7) is installed on all the machines accessing the >> pages. >> >> The Adobe Reader error message provided is: >> "There was an error opening this document. This file is already open or >> in use by another application." >> >> I've been searching further afield and note that a few people have logged >> similar problems, particularly for PDF output. >> >> One suggestion is to alter the metabase.xml file to allow greater sizes >> of AspBufferingLimit, e.g. set it to "2000000000" (2Gb). >> However, the test files I'm using are only in the 85Kb range, so clearly >> shouldn't be a problem for the default limit of 4Mb. >> >> Interestingly, the XP PC I'm using to develop on doesn't have a >> metabase.xml - presumably one of the differences between the versions of >> IIS for XP and Windows Server 2003. >> >> Al >> >> >> >> "Kevin Spencer" <> wrote in message >> news:... >>> It didn't fail on this client. Are you sure that the Adobe acrobat >>> reader was installed on the machine on which it failed? Can you describe >>> in detail what you mean by "failed?" >>> >>> -- >>> HTH, >>> >>> Kevin Spencer >>> Microsoft MVP >>> Professional Numbskull >>> >>> Show me your certification without works, >>> and I'll show my certification >>> *by* my works. >>> >>> "Alec MacLean" <> wrote in message >>> news:... >>>> Hi, >>>> >>>> I've created a small application for our company extranet (staff >>>> bulletins) >>>> that outputs a list of links to PDF's that are stored in a SQL table. >>>> The >>>> user clicks a link and the PDF is loaded into a new browser window. >>>> >>>> This works as expected on the test PC (using forms authentication, but >>>> no >>>> SSL) using IE. It also works as expected on the production server when >>>> using FireFox. The production server environment is using forms >>>> authentication and SSL. >>>> >>>> However the PDF load fails when using IE as the browser to access the >>>> production server (which my users/staff colleagues will be doing). >>>> >>>> I have also tested it without using SSL or Forms authentication by >>>> putting >>>> it on our public site on the production server. >>>> This also means you can (temporarily) see the problem for yourself >>>> at: www.copeohs.com/ebulletins/bulletins.aspx >>>> >>>> The error seems to be generated by Adobe Reader rather than >>>> specifically IE, >>>> but as the system works using FireFox, I am guessing it is the >>>> relationship >>>> between IE and Adobe Reader that is the problem? >>>> >>>> The Adobe Reader error message provided is: >>>> "There was an error opening this document. This file is already open >>>> or in >>>> use by another application." >>>> >>>> I am using VB.NET 1.1 on IIS 6 (win 2003 svr). >>>> >>>> Code snippet that outputs the PDF from the DB: >>>> -------------------------------------------------------- >>>> 'The required file ID comes from the querystring. >>>> If Me.Request.IsAuthenticated Then >>>> If Request.QueryString.Count <> 0 Then >>>> 'Get the (pdf) filename to display >>>> Me.FileID = CInt(Request.QueryString("doc").ToString) >>>> Dim ds As New DataSet >>>> Dim PDFfileSize As Long >>>> Dim db As Database = DatabaseFactory.CreateDatabase >>>> Dim cmd As DBCommandWrapper = >>>> db.GetStoredProcCommandWrapper("usp_Bulletin_Singl e_SELECT") >>>> cmd.AddInParameter("@BID", DbType.Int32, Me.FileID) >>>> >>>> Try >>>> Me.lblErr.Visible = False >>>> 'Load the record (PDF file) into local dataset >>>> db.LoadDataSet(cmd, ds, "theBulletin") >>>> >>>> 'Resize the byte array for file >>>> PDFfileSize = >>>> CLng(ds.Tables("theBulletin").Rows(0).Item("BFile" ).length) >>>> Dim thePDF(CInt(PDFfileSize)) As Byte >>>> >>>> 'Put the PDf into the byte array >>>> thePDF = ds.Tables("theBulletin").Rows(0).Item("BFile") >>>> >>>> 'Send the file to the output stream >>>> Response.BufferOutput = True >>>> >>>> 'Try and ensure the browser always opens the file and doesn't just >>>> prompt to "open/save". >>>> Response.AddHeader("Content-Disposition", "inline") >>>> >>>> 'Set the output stream to the correct content type (PDF). >>>> Response.ContentType = "application/pdf" >>>> >>>> 'Output the file >>>> Response.BinaryWrite(thePDF) >>>> >>>> thePDF = Nothing >>>> >>>> Catch ex As Exception >>>> Me.lblErr.Visible = True >>>> Me.lblErr.Text = ex.Message.ToString >>>> >>>> Finally >>>> 'Tidy memory >>>> ds = Nothing >>>> cmd = Nothing >>>> db = Nothing >>>> End Try >>>> >>>> End If >>>> Else >>>> Response.Redirect("/logon/applist.aspx") >>>> End If >>>> -------------------------------------------------------- >>>> >>>> I would greatly appreciate any help/ideas offered...thanks in advance. >>>> >>>> Al >>>> >>>> >>>> >>> >>> >> >> > > Alec MacLean |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CISCO 1801 DNS problem | marsav | Hardware | 2 | 07-05-2009 11:41 PM |
| Different types of video output - I'm confused | robotiser@googlemail.com | DVD Video | 2 | 07-29-2007 04:25 PM |
| Post-Route Simulation does not give output for the first clock cycle Options | velocityreviews | Software | 0 | 04-17-2007 05:47 PM |
| Sony Precision Cinema Progressive Output vs Component 480p Output | Otto Pylot | DVD Video | 1 | 04-18-2004 10:49 PM |
| Panasonic S25 DVD player w/o S-video output - will its replacement have S-video? | Mark | DVD Video | 1 | 02-11-2004 04:19 PM |