c# - InternetSetCookie returns ERROR_INVALID_OPERATION -
i'm trying expire cookie on machine. when call wininet.dll internetsetcookie
returns false
, error code 4317
generic error_invalid_operation
.
[dllimport("wininet.dll", setlasterror = true)] private static extern bool internetsetcookie(string lpszurlname, string lpszcookiename, string lpszcookiedata); public void main() { internetsetcookie("http://example.com","cookiename","somevalue;expires=mon, 01 jan 0001 00:00:00 gmt") }
is there anyway more info on operation invalid?
is there anyway more info on operation invalid?
no there not.
however, getting error_invalid_operation
because trying set cookie has been set ( couldn't edit cookie using internetsetcookie()
). had clear cookies using function. need declare first:
[dllimport("wininet.dll", setlasterror = true)] private static extern bool internetsetoption(intptr hinternet,int dwoption,intptr lpbuffer, int lpdwbufferlength);
then can use in following fashion clear cookies ( note 42
internet_option_send_browser_session
) :
bool iscleared=internetsetoption(intptr.zero, 42, intptr.zero, 0);
Comments
Post a Comment