473,602 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.DataService s.Imaging.Imagi ngFactory
Dim oDataset As DataSet
Dim oPDF As New WebSupergoo.ABC pdf4.Doc
Dim oPDFBytes As WebSupergoo.ABC pdf4.Doc

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

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache)
Response.Cache. SetExpires(Now( ))
Response.ClearH eaders()
Response.ClearC ontent()

'Response.Expir es = -1
'Response.Buffe r = True
'Response.Clear ()
''Response.Cach e.SetNoServerCa ching()
''Response.Expi resAbsolute = New DateTime(2002, 1, 1, 0, 0, 0)
''Response.Cach eControl = "Public"
''Response.Cach eControl = "no-cache"
''Response.Cach e.SetNoStore()

'create temporary license
oPDF.SetInfo(0, "License",
ConfigurationSe ttings.AppSetti ngs("abcPDFLice nseKey"))
'populate the dataset from session
oDataset = CType(Session(" dsSelectedImage List"), DataSet)

For Each oDataRow As DataRow In oDataset.Tables (0).Rows
Dim docID As New
CFN.DataService s.Imaging.Docum entIdentifier
Dim sReportID As String = CType(oDataRow. Item("reportID" ),
String)
Dim sReportVersionI D As String =
CType(oDataRow. Item("versionID "), String)
Dim sReportSectionI D As String =
CType(oDataRow. Item("sectionID "), String)
oPDFBytes = New WebSupergoo.ABC pdf4.Doc

docID.ReportID = sReportID
docID.SectionID = sReportSectionI D
docID.VersionID = sReportVersionI D

If sReportID = "CONF" Then
oPDFBytes.Read( imgFactory.Trad eConfirmOverlay (docID,
Page.User.Ident ity.Name))
Else
oPDFBytes.Read( imgFactory.GetP DFBytes(docID,
Page.User.Ident ity.Name))
End If

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

Dim theData() As Byte
theData = oPDF.GetData

oPDF.Clear()
oPDF = Nothing

Dim d As Date = Now()

Response.Conten tType = "applicatio n/pdf"
Response.AddHea der("Pragma", "no-cache")
Response.AddHea der("Expires", "-1")
Response.AddHea der("content-disposition", "inline; filename=" +
Session.Session ID + CType(d.Second, String) + CType(d.Minute, String) +
"ImagePacket.pd f;")
Response.AddHea der("content-length", theData.Length. ToString())

Response.Binary Write(theData)
'Response.Outpu tStream.Write(t heData, 0, theData.Length)

'Dim fs As FileStream
'fs = File.Create("c: \temp\test.txt" )
'Dim sw As StreamWriter
'sw = New StreamWriter(fs )
'sw.Write(Syste m.Text.Encoding .ASCII.GetStrin g(theData))

'Response.Write (System.Text.En coding.ASCII.Ge tString(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 2980

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

Similar topics

0
2037
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 the thread is over a month old, I decided to start a new one with my response. Please see my comments inline.
2
6958
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 does not work for me. In fact, it does work once, the first time I wrote these lines in the Application_BeginRequest event of the Global.asax file: Response.Buffer = True Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))...
10
1477
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 displayed at the top of the page. The page that was redirected towards does not come up. Any ideas?
0
1068
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 removed from cache. The handler method deletes specified file from disk. The problem is that the cache is cleared upon application shutdown and all cached objects are implicitly removed. This involves that my handler is also called and the...
3
2034
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 service response after each call to show a progress to user. I used following code to test, but it does not work and after user clicks on start button, page will not be refreshed with each Response.Flush() call, and only after finishing the loop all...
5
9133
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 that way, but i left it in anyway. little did i know it would cause a problem for a forced download routine i have. instead of downloading the .xls attachment, it tried to download the aspx file, and gave an error saying the file could not be...
0
1626
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 Further, cache contents can be cleared by issuing the following command:
12
1491
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 response.Redirect("pregled.asp?ime=" & strUserName & " & prezime = " & strUserLastName) but it didn't work.
0
7993
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.