首页 > 解决方案 > 清除特定 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

标签: cachingvb6browser-cache

解决方案


问题解决了:

尽管我可以查看文件的新内容,但 Internet 提供商并未公开该文件,但它不向公众提供,旧的可以。

因此,没有更新的不是缓存,而是网站本身。

感谢观看和贡献。

案例已结束,希望对其他人有所帮助。


推荐阅读