caching - 清除特定 Internet 缓存 vb6.0
问题描述
当我下载一个文本文件来读取内容时,下一次我没有得到文件的更改内容。不知何故,缓存文件被读取,而不是 Internet 站点上的更新文件。有没有办法在下载和阅读后直接从缓存中删除特定文件?
'API used:
Public Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
'Internet Read Text File Content
If FileExists(FileToCreate) = True Then
Kill (FileToCreate) ' kill it to make sure it is created by this routine
End If
If INetThere = True Then ' checks if there is an Internet connection
On Error Resume Next ' Issue with Digital Certification, to be resolved later.
BaK = URLDownloadToFile(0, FileToGet, FileToCreate, 0, 0)
On Error GoTo 0
If Err.Number <> 0 Then MsgBox (Err.Number)
End If
If FileExists(FileToCreate) Then ' get content: CACHE problem, reads old file from memory instead of Internet file content
VrijeFile = FreeFile
Open FileToCreate For Input As #VrijeFile
Line Input #VrijeFile, VersionBAK ' this line gets the data from the old, previously read file in chache
Close #VrijeFile
Kill (FileToCreate)
End If
If VersionBAK <> "" Then
LeesRegeL = VersionBAK
UpdateMajor = VBA.Val(VBA.Trim$(Chop_On(vbDot)))
UpdateMinor = VBA.Val(VBA.Trim$(Chop_On(vbDot)))
UpdateRevision = VBA.Val(VBA.Trim$(LeesRegeL))
End If
New_LCWin_Version = (UpdateMajor > LCWinMajoR) Or (UpdateMinor > LCWinMinoR) Or (UpdateRevision > LCWinReviSioN)
CheckForUpdate = New_LCWin_Version ' end result for the function returned
解决方案
问题解决了:
尽管我可以查看文件的新内容,但 Internet 提供商并未公开该文件,但它不向公众提供,旧的可以。
因此,没有更新的不是缓存,而是网站本身。
感谢观看和贡献。
案例已结束,希望对其他人有所帮助。
推荐阅读
- symfony - 具有角色数组的 Twig is_granted()
- mysql - 减少mysql查询中的空行
- asp.net-core - 在 asp.net core MVC 中使用剑道网格和存储过程以及具有存储库模式的 dapper 进行 CRUD 操作
- javascript - 使用 JavaScript 将新对象添加到 JSON 数组
- javascript - 反应 onClick 接收内联样式
- linux - AWK 使用的替代方案
- arrays - 在 Ruby 中进行此数组比较的正确方法是什么?
- r - 基于相对于指示行的滞后和超前范围的数据框中的子集行
- vue.js - Trix 编辑器不呈现存储的内容
- php - 错误:“请求中止” axios laravel vuejs