我如何在网络浏览器控制领域安装和删除 co(,允许在不浏览网站的情况下建立/删除 co。
I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...
我如何在网络浏览器控制领域安装和删除 co(,允许在不浏览网站的情况下建立/删除 co。
通过将以下工作结合起来来管理完成这项任务:
http://support.microsoft.com/kb/815718
http://msdn.microsoft.com/en-us/library/windows/desktop/a385328(v=vs.85).aspx”rel=“nofollow”http://msdn.microsoft.com/en-us/library/windows/desktop/a385328(v=vs.85)。
希望这一帮助
using System.Runtime.InteropServices;
namespace Storm8
{
class Program
{
[DllImport("wininet.dll", SetLastError = true)]
private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);
[DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool InternetGetCookie(
string lpszUrlName,
string lpszCookieName,
StringBuilder lpszCookieData,
[MarshalAs(UnmanagedType.U4)]
ref int lpdwSize
);
[DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool InternetSetCookie(
string lpszUrlName,
string lpszCookieName,
string lpszCookieData
);
[DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool InternetSetOption(
int hInternet,
int dwOption,
string lpBuffer,
int dwBufferLength
);
[STAThread]
static void Main(string[] args)
{
InternetSetOption(0, 42, null, 0);
InternetSetCookie("http://domain.name.com", "cookiename", "cookievalue");
WebBrowser wb = new WebBrowser();
string testUrl = "http://domain.name.com/fight.php?showAttackBg=true";
string additionalHeaders = "User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit /528.18 (KHTML, like Gecko) Mobile/7A341" + Environment.NewLine +
"Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + Environment.NewLine +
"Accept-Language: en-gb";
if (wb.Document == null)
wb.Navigate(testUrl, null, null, additionalHeaders);
while (wb.Document == null)
Application.DoEvents();
Console.WriteLine("
Press any key to continue...");
Console.ReadKey(true);
}
}
}
IE Uses WinInet functions for networking so you can use WinInet s cookie functions to change the cookie. Update: The requirement demands per-process setting. Since the cache folder location is not stored in IE settings registry key IDocHostUIHandler2::GetOverrideKeyPath won t work. I don t know a way to customize the cookie folder location at the process level except to hook all WinInet APIs (and stuck with updating application to accommodate future WinInet APIs).
这里的微额解决办法是,只清除 co(C/C++):
#include <wininet.h>
#include <winineti.h>
...
DWORD dwSuppress = INTERNET_SUPPRESS_COOKIE_PERSIST;
InternetSetOption(0, INTERNET_OPTION_SUPPRESS_BEHAVIOR, &dwSuppress, sizeof(DWORD));
http://mdb-blog.blogspot.fr/02/c-winforms-webbrowser-clear-all-cookies.html (C#)。 Don tabes toeck the documentation for ;InternetSetOption和
I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...
I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...
I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?
How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...
I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...
When I m trying to change the default Image of a Control on Windows Forms in Form Designer (no matter where on which control) I get this error: Error message: An item with the same key has ...
I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.