473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

How to use WinHttp.dll

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_OnResponseFinishedEventHandl er(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 !

Jun 27 '07 #1
2 2709
On Jun 27, 3:40 pm, Siva M <shiva...@online.excite.comwrote:
If Async is true, then try declaring the winHttpReq at the class level.

"flyingchen" wrote:
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_OnResponseFinishedEventHandl er(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 !
Thanks a lot ! How clever you are !

Jun 27 '07 #2
If Async is true, then try declaring the winHttpReq at the class level.

"flyingchen" wrote:
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_OnResponseFinishedEventHandl er(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 !

Jun 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: yukeshean | last post by:
hi, I'm helping a company to develop a merchant site for online transaction. Since the company already registered with Telemoney payment gateway to handle the credit card verification, therefore...
1
by: yukeshean | last post by:
how to use winhttp with asp to talk to Telemoney payment gateway server? how to use winhttp to make few communication link with telemoney and the links involve more than 1 asp page?
0
by: thueirby | last post by:
h when i try to get data from site with clients sertificates with winHttp, I have a problem with result encoding (ru). Its OK with any sites without client sertificates, and its OK when i try to...
0
by: Bryce | last post by:
H I am using WinHTTP to hit a server. I need to provide Proxy credentials to navigate through a proxy server, as well as Server credentials to access the server I have called the...
1
by: Francis | last post by:
I have the following codes in an asp file. This page can receive the XML string send from client. ================================================== Dim objReceive Set objReceive =...
0
by: Vijay | last post by:
Hi, I am trying to use Winhttp for making a SOAP request from a client to a Server, windows 2003. I have 2 issues: 1. I am making a Winhttp, HTTP request and I keep getting this error,...
1
by: saravana kumar | last post by:
Hai , I am new to winHTTP. Can anyone point me out a good website to find few startup samples and details about winHTTP. Please help me out to start winHTTP. :confused: Any help appreciated....
1
by: Gaetan | last post by:
I'm doing a prrof of concept to develop an application to run under WinPE. The application will use WinHTTP to send requests to an ASPX file running IIS 6.0 My problem is that I do not know how...
1
by: Balex | last post by:
Hi This is a question for people who know and use the winhttp DLL from MS. I need to be able to simulate the entry by users of data into a web-based application. So I started with using winhttp...
4
by: Ted Lyngmo | last post by:
Hi! I'm new (but please do continue reading) to C++ in the VS environment and wanted to create a standalone program (or preferably, a static library, compatible with other Windows compilers)...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.