0

我正在寻找一个 C# 脚本库,它将当前 URLS 添加到不需要构建单独的类调用的 IE 书签。我正在尝试构建一个脚本,该脚本采用当前 URL 并将其保存到收藏夹...任何帮助将不胜感激我是菜鸟,我试图弄清楚这一点。我现在正试图保存饼干,但这似乎没有希望

 Manager.LaunchNewBrowser();

 const string url = "www.google.com";
{
var cookie = new Cookie("foo", "bar", "/", url);
cookie.Expires = DateTime.MaxValue;
var ok = ActiveBrowser.Cookies.SetCookie(cookie);
}

var c = ActiveBrowser.Cookies.GetCookies("http://www.google.com");
var count = c.Count;

Log.WriteLine(count.ToString());
foreach (Cookie cookie in ActiveBrowser.Cookies.GetCookies("http://www.google.com"))
{
Log.WriteLine(cookie.Name);
}
4

1 回答 1

3

C# is not a scripting language, it's a server-side programming language part of the Microsoft .NET (dot net) platform. You should use Javascript (JS) for client-side scripting in the browser.

Please read, for example, the answers posted to this StackOverflow question:

How do I add an "Add to Favorites" button or link on my website?

(and of course there are many more examples to find around the web, through your favorite search engine).

于 2013-04-03T15:07:35.130 回答