IIS6 file download problem

IIS6 file download problem

Post by larr » Sun, 25 Jul 2004 07:46:29


Hi,

I had a project which download files from our company server. It always
worked before until we switch to IIS 6 (win2003).
My program always get "<h1>Bad Request (Invalid Header Name)</h1>".

I checked MS site, and got article "828726": which says:
----------------------
"In Microsoft Internet Information Services (IIS) 6.0, when a request
contains a header name that includes a question mark (?) character or
another separator character, Http.sys rejects the request and sends the
following error message to the requestor:


Bad Request (Invalid Header Name)"
----------------------

here is my code, anyone can help me to take out the "separator character"?
or any other way to do that?
thanks a lot,
larry


---------------------------------------------
CHttpUpdater * p = (CHttpUpdater*)pTran;
CString szHeaders = _T("Accept: */*\r\nUser-Agent: InetHttp\r\n");


LPCTSTR pstrAcceptTypes ="*/*";
DWORD dwFlags = INTERNET_FLAG_EXISTING_CONNECT;// |
INTERNET_FLAG_NO_AUTO_REDIRECT;
TRY
{
if (p->IsHalt()) AfxThrowUserException();
p->m_pFile = p->m_pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,
p->m_sRemoteFileName, NULL, 1, &pstrAcceptTypes, NULL, dwFlags);

p->m_pFile->AddRequestHeaders(szHeaders);

. . .
}