如何获取Internet Explorer下载历史记录?

时间:2012-10-30 05:40:31

标签: c# .net internet-explorer

有没有办法获取IE的下载历史记录?

我们从downloads.sqlite文件获取Firefox的下载历史记录,我们从history.sqlite文件中获取Chrome的下载历史记录。

但如何在IE中找到答案?

1 个答案:

答案 0 :(得分:0)

试试这段代码片段:

public class InternetExplorer
{
    // List of URL objects
    public List<URL> URLs { get; set; }
    public IEnumerable<URL> GetHistory()
    {
        // Initiate main object
        UrlHistoryWrapperClass urlhistory = new UrlHistoryWrapperClass();

        // Enumerate URLs in History
        UrlHistoryWrapperClass.STATURLEnumerator enumerator =
        urlhistory.GetEnumerator();

        // Iterate through the enumeration
        while (enumerator.MoveNext())
        {
            // Obtain URL and Title
            string url = enumerator.Current.URL.Replace('\'', ' ');
            // In the title, eliminate single quotes to avoid confusion
            string title = string.IsNullOrEmpty(enumerator.Current.Title)
            ? enumerator.Current.Title.Replace('\'', ' ') : "";

            // Create new entry
            URL U = new URL(url, title, "Internet Explorer");

            // Add entry to list
            URLs.Add(U);
        }

        // Optional
        enumerator.Reset();

        // Clear URL History
        urlhistory.ClearHistory();

        return URLs;
    }
}

参考文献:

  1. How to show Internet Explorer's History in a control?
  2. Get Web browser history in C#
  3. How to access Internet Explorer History in C#
  4. IE history in C#