Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than wininet, prefix the name with the module name and a period.
InternetGetCookie (wininet)
.
C# Signature:
[DllImport("wininet.dll", CharSet=CharSet.Auto, SetLastError=true)]
static extern bool InternetGetCookie(string lpszUrlName, string lpszCookieName,
[Out] string lpszCookieData, [MarshalAs(UnmanagedType.U4)] out int lpdwSize);
VB Signature:
Declare Auto Function InternetGetCookie Lib "wininet.dll" ( _
ByVal lpszUrlName As String, ByVal lpszCookieName As String, _
ByVal lpszCookieData As String, ByRef lpdwSize As Integer) As Boolean
User-Defined Types:
None.
Notes:
You can pass null (Nothing in Visual Basic) to the lpszCookieData parameter to get the require buffer size from the lpdwSize parameter.
Tips & Tricks:
Please add some!
Sample Code:
private static CookieContainer GetUriCookieContainer(Uri uri)
{
CookieContainer cookies = null;
int datasize = 256;
StringBuilder cookieData = new StringBuilder(datasize);
if (!InternetGetCookie(uri.ToString(), null, cookieData, ref datasize))
{
if (datasize < 0)
{
return null;
}
cookieData = new StringBuilder(datasize);
if (!InternetGetCookie(uri.ToString(), null, cookieData, ref datasize))
return null;
}
if (cookieData.Length > 0)
{
cookies = new CookieContainer();
cookies.SetCookies(uri, cookieData.ToString().Replace(';', ','));
}
return cookies;
}
Alternative Managed API:
Do you know one? Please contribute it!
TODO - a short description
1/3/2016 10:42:38 PM - -24.196.238.245
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).