How to use WinHttp.dll

F

flyingchen

The problem is about the new version of the WinHttp.dll.
My Code like this :

public string Do(string Method,string Url,Object Async)
{
WinHttpRequest winHttpReq = new
WinHttp.WinHttpRequestClass();

winHttpReq.OnResponseStart += new
IWinHttpRequestEvents_OnResponseStartEventHandler(winHttpReq_OnResponseStart);
winHttpReq.OnResponseFinished += new
IWinHttpRequestEvents_OnResponseFinishedEventHandler(winHttpReq_OnResponseFinished);

try
{
winHttpReq.Open(Method, Url, Async);
}
catch (Exception)
{
throw;
}

winHttpReq.Send(null);

return winHttpReq.ResponseText;
}

void winHttpReq_OnResponseFinished()
{
// to do sth
}

void winHttpReq_OnResponseStart(int Status, string
ContentType)
{
// to do sth
}

The programe can build and run ,but the two events of the
WinHttpRequestClass can not run anytime. But they're very important to
me . Help!
Thanks a lot !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top