ITking2009
Programmer
I am working on converting a VB6 app into C# app.
Here what i need to do
Public Function SendData(sUsername as string ,sPassword as string, url as string , message as string ) As Boolean
Dim XMLHttpRequest As MSXML2.XMLHTTP40
Set XMLHttpRequest = New MSXML2.XMLHTTP40
XMLHttpRequest.Open "GET", g_SonyFeedURL, True, sUsername, sPassword
XMLHttpRequest.setRequestHeader "Synchronous", "False"
XMLHttpRequest.setRequestHeader "Content-Type", "text/xml"
XMLHttpRequest.setRequestHeader "Accept-Language", "en-US"
dtStart = Now
XMLHttpRequest.send
Do While XMLHttpRequest.ReadyState <> 4
DoEvents
TimeOut = DateDiff("s", dtStart, Now)
If TimeOut >= WaitTime Then 'Wait
Exit Do
End If
Loop
End function
Now i understand i can do the above using httpwebrequest but not able to figure how to send the username and password or in other words what would be c# equivalent of
"XMLHttpRequest.Open "GET", g_SonyFeedURL, True, sUsername, sPassword "
and DoEvents so that i can make it wait for couple of min and if i dont get a reponse abort the request?
Any suggestions?
Thanks.
Here what i need to do
Public Function SendData(sUsername as string ,sPassword as string, url as string , message as string ) As Boolean
Dim XMLHttpRequest As MSXML2.XMLHTTP40
Set XMLHttpRequest = New MSXML2.XMLHTTP40
XMLHttpRequest.Open "GET", g_SonyFeedURL, True, sUsername, sPassword
XMLHttpRequest.setRequestHeader "Synchronous", "False"
XMLHttpRequest.setRequestHeader "Content-Type", "text/xml"
XMLHttpRequest.setRequestHeader "Accept-Language", "en-US"
dtStart = Now
XMLHttpRequest.send
Do While XMLHttpRequest.ReadyState <> 4
DoEvents
TimeOut = DateDiff("s", dtStart, Now)
If TimeOut >= WaitTime Then 'Wait
Exit Do
End If
Loop
End function
Now i understand i can do the above using httpwebrequest but not able to figure how to send the username and password or in other words what would be c# equivalent of
"XMLHttpRequest.Open "GET", g_SonyFeedURL, True, sUsername, sPassword "
and DoEvents so that i can make it wait for couple of min and if i dont get a reponse abort the request?
Any suggestions?
Thanks.