473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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

PD
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.Cache.SetExpires(Now())
Response.ClearHeaders()
Response.ClearContent()

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

'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
CFN.DataServices.Imaging.DocumentIdentifier
Dim sReportID As String = CType(oDataRow.Item("reportID"),
String)
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,
Page.User.Identity.Name))
Else
oPDFBytes.Read(imgFactory.GetPDFBytes(docID,
Page.User.Identity.Name))
End If

oPDF.Append(oPDFBytes)
oPDFBytes.Clear()
oPDFBytes = Nothing
Next

Dim theData() As Byte
theData = oPDF.GetData

oPDF.Clear()
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) +
"ImagePacket.pdf;")
Response.AddHeader("content-length", theData.Length.ToString())

Response.BinaryWrite(theData)
'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))
Response.Flush()
Response.Close()
Response.End()

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!
Pat

Nov 19 '05 #1
0 2962

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andreas Suurkuusk | last post by:
Hi, I just noticed your post in the "C# memory problem: no end for our problem?" thread. In the post you implied that I do not how the garbage collector works and that I mislead people. Since...
2
by: Promenade | last post by:
Hi, everyone... I want to avoid the user to use the navigator back button. For that reason, I tried all the possible ways to set the Expires property of the Response Object, but whatever I do, it...
10
by: Johnny Fugazzi | last post by:
I have a couple of pages that have started showing an odd problem. When the code calls Response.Redirect("file.aspx"), nothing happens. The page goes white, and the old URL and querystring are...
0
by: Micha³ Januszczyk | last post by:
is there any way to tell whether the application has entered the shutdown state ? I put some data into aspnet cache. Special callback method is specified that should be called when cache item is...
3
by: masoud bayan | last post by:
Hi, I am developing an asp.net page that iteratively (inside a loop) calls a web service at the backend and shows the result to user. For this purpose I should update page with the web...
5
by: Tim_Mac | last post by:
hi, i read that by adding the following code to by aspx pages, it would not store temporary internet files: Response.Cache.SetCacheability(HttpCacheability.NoCache); it didn't actually work...
0
by: negmat | last post by:
Hello everyone, I have the following question: I am aware that the objects currently in the cache can be viewed by issuing the following command: SELECT * FROM master.dbo.Syscacheobjects ...
12
by: gigi | last post by:
How to send more than one value using response redirect? For example i can send one like this response.Redirect "pregled.asp?ime=" & strUserName but how to send two or more values? I tried...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.