获取C#中IE缓存文件的URL [英] Get URL of a IE Cached file in C#
本文介绍了获取C#中IE缓存文件的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我需要一个可能看起来很奇怪的东西:我需要在IE中获取某些缓存文件的网址:D
我使用FileSystemWatcher监视缓存文件夹,因此在创建某些文件时会触发事件.这样,我可以拥有完整的文件路径,现在我必须获取其URL
基本上,您可以假设我希望我的程序将在Internet临时文件夹中创建的每个.jpg的URL写入文件.
Hello to all!
I need a thing that may seem strange: I need to get the url of some cached files in IE :D
I''ve used a FileSystemWatcher to monitor the cache folder so it fires an event when certain files are created. This way I can have full file path, now I have to get their URLs
Basically, you can assume I want my program to write on a file the URL of every .jpg that''s created in the Temporary Internet Files folders
推荐答案
如果文件在您的网站目录(虚拟目录)中,则生成任何文件的URL.否则,
示例:
我的项目目录是.
D:\ ApplicationDir \ MyWebiste1.
根URL是http://mywebsiteserver.com/index.aspx(index.aspx页面位于MyWebsite1文件夹中,表示其根目录)
如果文件路径为
D:\ ApplicationDir \ MyWebiste1 \ Folder1 \ File.txt
该URL将为http://mywebsiteserver.com/folder1/file.txt
要以编程方式生成此路径,您需要进行一些字符串分割和补充.例如,从文件路径中删除"D:\ ApplicationDir \",并在其余文件路径后连接"http://mywebsiteserver.com/".将``\''替换为``/''.
这是一个粗略的主意..希望它将帮助您为您考虑一个完整的解决方案...
标记为答案是否可以解决您的问题.
you can generate URL of any file, if the file is inside your website directory (virtual directory). otherwise not,
Example:
My project Directory is.
D:\ApplicationDir\MyWebiste1.
root url is http://mywebsiteserver.com/index.aspx (the index.aspx page is inside MyWebsite1 folder, it means its a root)
if the File path is
D:\ApplicationDir\MyWebiste1\Folder1\File.txt
the URL will be http://mywebsiteserver.com/folder1/file.txt
to generate this path programatically, you need to do some string divisions and concatinations. like remove "D:\ApplicationDir\" from file path and concatenate "http://mywebsiteserver.com/" after the remaining file path. replace ''\'' with ''/''.
its a rough idea.. hope it will help you to think a full solution for you...
mark as answer if solves your problem.
我使用wininet.dll来获取缓存中每个条目的url,然后搜索了我正在寻找的文件
I used wininet.dll to get url of every entry in the cache and then searched for the file I was looking for
这篇关于获取C#中IE缓存文件的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文