472,139 Members | 1,318 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

Response Object - Cache Problem. It's not clearing.

I am trying to stream out a PDF file via the response object and when I
execute the code it always brings up the first document that I pulled
up.Even when I step through the code, I can see the new values in
theData string array (see code below), but it serves up the first
document that I had run this code with. I streamed theData into a text
file to look at the values and it contained the appropriate ones for
the new document. Even when I close out of the browser or clear out IE
variables, etc. it still always pulss up the first document. I'm
thinking it could be a cache issue, but everything I have tried in
clearing out the cache has not been successful.

Private Sub CreatePDF()
Dim imgFactory As New CFN.DataServices.Imaging.ImagingFactory
Dim oDataset As DataSet
Dim oPDF As New WebSupergoo.ABCpdf4.Doc
Dim oPDFBytes As WebSupergoo.ABCpdf4.Doc

Dim bytes() As Byte
Dim imgString As String
Dim pageID As Int32
Dim pageCount As Int32 = 1

Response.Cache.SetCacheability(HttpCacheability.No Cache)

'Response.Expires = -1
'Response.Buffer = True
''Response.ExpiresAbsolute = New DateTime(2002, 1, 1, 0, 0, 0)
''Response.CacheControl = "Public"
''Response.CacheControl = "no-cache"

'create temporary license
oPDF.SetInfo(0, "License",
ConfigurationSettings.AppSettings("abcPDFLicenseKe y"))
'populate the dataset from session
oDataset = CType(Session("dsSelectedImageList"), DataSet)

For Each oDataRow As DataRow In oDataset.Tables(0).Rows
Dim docID As New
Dim sReportID As String = CType(oDataRow.Item("reportID"),
Dim sReportVersionID As String =
CType(oDataRow.Item("versionID"), String)
Dim sReportSectionID As String =
CType(oDataRow.Item("sectionID"), String)
oPDFBytes = New WebSupergoo.ABCpdf4.Doc

docID.ReportID = sReportID
docID.SectionID = sReportSectionID
docID.VersionID = sReportVersionID

If sReportID = "CONF" Then
oPDFBytes.Read(imgFactory.TradeConfirmOverlay(docI D,
End If

oPDFBytes = Nothing

Dim theData() As Byte
theData = oPDF.GetData

oPDF = Nothing

Dim d As Date = Now()

Response.ContentType = "application/pdf"
Response.AddHeader("Pragma", "no-cache")
Response.AddHeader("Expires", "-1")
Response.AddHeader("content-disposition", "inline; filename=" +
Session.SessionID + CType(d.Second, String) + CType(d.Minute, String) +
Response.AddHeader("content-length", theData.Length.ToString())

'Response.OutputStream.Write(theData, 0, theData.Length)

'Dim fs As FileStream
'fs = File.Create("c:\temp\test.txt")
'Dim sw As StreamWriter
'sw = New StreamWriter(fs)
'sw.Write(System.Text.Encoding.ASCII.GetString(the Data))

'Response.Write(System.Text.Encoding.ASCII.GetStri ng(theData))

End Sub

I have tried setting the cache properities between the HTML HEAD tags
as per suggested with other posts, to no avail. I have tried running
the application from another PC to see if anything would change. I
checked my IE settings to ensure page is being refreshed for every
visit to the page. The application is running on my localhost.

Any suggestions/insight would be greatly appreciated!

Nov 19 '05 #1
0 2863

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Promenade | last post: by
10 posts views Thread by Johnny Fugazzi | last post: by
reply views Thread by Micha³ Januszczyk | last post: by
3 posts views Thread by masoud bayan | last post: by
12 posts views Thread by gigi | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.