访问Internet临时文件(C#) [英] Accessing Temporary Internet Files (C#)

查看:59
本文介绍了访问Internet临时文件(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我错了,请纠正我,所有查看的网站都将他们的htm / html / aspx / jsp页面下载到Temporary Internet Files中吗?我正在尝试访问Internet临时文件以从这些网站收集和复制信息。例如,如果
我在维基百科上查看一个页面,我想从我的临时Internet文件中提取HTML文件,然后从中提取维基百科的内容。



所以我正在做一个实验,看看我是否可以从我的Internet临时文件中复制文件



我正在尝试访问我的Internet临时文件和然后复制出一些在网页完成加载或之后访问的文件(这是为了确保我只复制出我正在查看的网站上的文件) 
但它无法正常工作。



除此之外,即使我尝试手动打开我的临时Internet文件,我也看不到任何htm / html / aspx / jsp,我看到的只是图像和脚本。我不确定我是否正确的方向开始。请告诉我。



[CODE]



私人无效webBrowser1_DocumentCompleted(对象发件人,WebBrowserDocumentCompletedEventArgs E)

        {

            currentDateTime = DateTime.Now;

        }


private void toolStripButton1_Click(对象发件人,EventArgs e)

        {

           

            String temporaryInternetFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);

            DirectoryInfo directoryInfo = new DirectoryInfo(temporaryInternetFilesPath);

            int x = 0;

            foreach(fileInfo fileInfo in directoryInfo.GetFiles())

            {

                if(fileInfo.LastAccessTime> = currentDateTime)

                {

                    fileInfo.CopyTo(@" C:\Users\XXXXX \Documents\Visual Studio 2010 \Projects\WindowsFormsApplication1 \WindowsFormsApplication1\bin\Debug\Test\fileCopy"
+ X + QUOT; .TXT");

                &NBSP ;   x = x + 1;

                }
            }
        } [/ CODE]

Correct me if I am wrong, ALL web sites viewed have their htm/html/aspx/jsp pages downloaded into the Temporary Internet Files right? I am trying to access the Temporary Internet Files to collect and copy Information from these web sites. For example if I view a page on Wikipedia, I want to pull the HTML file out of my Temporary Internet Files and then extract the content of the Wikipedia out of it.

So I am doing an experiment to see if I can copy files out of my Temporary Internet Files

I am trying to access my Temporary Internet Files and then copy out some files that are accessed at the same time the web page has completed loading or later(This is to ensure that I only copy out the files that from the web site I am currently viewing)  but it is not working.

On top of that even if I were to try manually open my Temporary Internet Files, I do not see any htm/html/aspx/jsp, all I see are images and scripts. I am unsure if I am even in the correct direction to start with. Please direct me.

[CODE]

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            currentDateTime = DateTime.Now;
        }

private void toolStripButton1_Click(object sender, EventArgs e)
        {
           
            String temporaryInternetFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
            DirectoryInfo directoryInfo = new DirectoryInfo(temporaryInternetFilesPath);
            int x = 0;
            foreach (FileInfo fileInfo in directoryInfo.GetFiles())
            {
                if (fileInfo.LastAccessTime >= currentDateTime)
                {
                    fileInfo.CopyTo(@"C:\Users\XXXXX\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Test\fileCopy" + x + ".txt");
                    x = x + 1;
                }
            }
        }[/CODE]

推荐答案

您好,

欢迎来到MSDN论坛。

Welcome to the MSDN Forum.

以下是与您有相同问题的已回答帖子。

Here is the answered thread which has the same issue as yours.

http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/c485f921-6378-4204- 9f2c-62d1adc1cbf1

另一方面,Temporary Internet Files文件夹是一个特殊的文件夹,存储了很多互联网文件,包括一些cookie 和其他隐私文件。

On the other hand, the the Temporary Internet Files folder is a special folder which stores a lot of internet files include some cookies  and other privacy files.

很难从文件夹中读取文件。

It hard to read the files from the folder.

也许你需要将你的问题发布到Internet Explorer论坛有关此问题的更多支持。所以,我会帮你把线程移到离题论坛。

Maybe you will need to post your questions to the Internet Explorer forum for more supports on this issue. So, I will help you to move the thread to the off-topic forum.

谢谢理解。

如果您有任何疑问,请随时告诉我们。

If you have any questions, please feel free to tell us.

最好的问候


这篇关于访问Internet临时文件(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆