maxixi
2005-04-13 17:10:12 UTC
Hi,
How to redirect request with extra cookies?
My request flag is INTERNET_FLAG_NO_COOKIES.
In the redirecting process i parsed the
"Set-Cookie" headers and save it to a
CookieContainer. I need to add the "Cookie"
in the new redirecting resource, How can i do?
private void StatusCallback(
IntPtr m_hHandle,
UInt32 dwContext,
WinInet.INTERNET_STATUS dwInternetStatus,
IntPtr lpvStatusInformation,
UInt32 dwStatusInformationLength)
{
case WinInet.INTERNET_STATUS.INTERNET_STATUS_REDIRECT:
m_nRedirectTimes++;
if (m_nRedirectTimes > m_nMaximumAutomaticRedirections) {
m_eStatus = RequestStatus.RedirectError;
m_eErrorEvent.Set();
}
else {
string str = Marshal.PtrToStringAnsi(lpvStatusInformation,
(int)dwStatusInformationLength - 1);
m_sResponseUri = new System.Uri(str);
string[] ss = WinInet.HttpQueryInfoStrings(m_hRequest,
WinInet.HTTP_QUERY.HTTP_QUERY_SET_COOKIE);
foreach(string st in ss) {
System.Net.Cookie c = Util.SetCookieParser(st);
if (c != null) m_pClient.m_oCookieContainer.Add(c);
}
}
}
Maxixi
How to redirect request with extra cookies?
My request flag is INTERNET_FLAG_NO_COOKIES.
In the redirecting process i parsed the
"Set-Cookie" headers and save it to a
CookieContainer. I need to add the "Cookie"
in the new redirecting resource, How can i do?
private void StatusCallback(
IntPtr m_hHandle,
UInt32 dwContext,
WinInet.INTERNET_STATUS dwInternetStatus,
IntPtr lpvStatusInformation,
UInt32 dwStatusInformationLength)
{
case WinInet.INTERNET_STATUS.INTERNET_STATUS_REDIRECT:
m_nRedirectTimes++;
if (m_nRedirectTimes > m_nMaximumAutomaticRedirections) {
m_eStatus = RequestStatus.RedirectError;
m_eErrorEvent.Set();
}
else {
string str = Marshal.PtrToStringAnsi(lpvStatusInformation,
(int)dwStatusInformationLength - 1);
m_sResponseUri = new System.Uri(str);
string[] ss = WinInet.HttpQueryInfoStrings(m_hRequest,
WinInet.HTTP_QUERY.HTTP_QUERY_SET_COOKIE);
foreach(string st in ss) {
System.Net.Cookie c = Util.SetCookieParser(st);
if (c != null) m_pClient.m_oCookieContainer.Add(c);
}
}
}
Maxixi