473,241 Members | 1,513 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,241 software developers and data experts.

MSXML2.XMLHTTP vb and c#

1
Hi developers,

currently i'm doing a school project and i am stuck on MSXML2.XMLHTTP conversion from vb code to c#.

Below is the vb Coding that i need to convert to C#

Expand|Select|Wrap|Line Numbers
  1.  Dim sUrl As String
  2.  
  3.         Dim xHttp As MSXML2.XMLHTTP
  4.  
  5.  
  6.  
  7.         sUrl = "http://" & sIPAddr & "/forms/push"
  8.  
  9.  
  10.  
  11.         xHttp = New MSXML2.XMLHTTP
  12.  
  13.         xHttp.open("POST", sUrl, True)
  14.  
  15.         xHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
  16.  
  17.         xHttp.setRequestHeader("Content-length", sValue.Length)
  18.  
  19.         xHttp.send(sValue)
  20.  
  21. I manage to understand it but i could not find any MSXML2.XMLHTTP to create in C#.
  22.  
  23. i try using this http post but it could not work or return the result i expected.
  24.  
  25. Below is the C# code i programmed
  26.  
  27. System.Net.WebRequest req = System.Net.WebRequest.Create(URI);
  28.  
  29.                 req.ContentType = "application/x-www-form-urlencoded";
  30.                 req.Method = "POST";
  31.  
  32.                 req.ContentLength = PostData.Length;
  33.  
  34.                 System.IO.Stream os = req.GetRequestStream();
  35.                 os.Write(bytes, 0, bytes.Length);
  36.  
  37.                 req.InitializeLifetimeService();
  38.  
  39.                 return os.CanRead.ToString();
Any help will be greatly appreciate.
Thank you
May 9 '07 #1
2 11224
kuser
2
Just checking - did you get the solution to this yet? I need to do the same type of thing.

The following statement generates an error in C# but NOT in VB. Same machine same project.
XMLHTTP40 mxml = new XMLHTTP40();

Error:
Retrieving the COM class factory for component with CLSID {88D969C5-F192-11D4-A65F-0040963251E5} failed due to the following error: 80040154.
Jun 14 '10 #2
Remove 40
XMLHTTP mxml = new XMLHTTP();
Oct 9 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dan Sikorsky | last post by:
Uploading from browser to server using Msxml2.XMLHTTP takes a long time about 15 minutes for a 1.5MB file at 37.2Kbps, although it does get there. Is there anyway to speed things up? here's the...
1
by: Dmitry | last post by:
I use MSXML2.XMLHTTP to receive some HHTP responces from remote server, unfortunatedly, it uses cookie-based auth., so I am unable to pass it, due to inability to store cookies. How can I retrieve...
1
by: Eric | last post by:
I have a form with an INPUT type=file in it. I have another button that calls a function to exercise the oHTTP below. I think I need to open with the path of the CGI script on the server. What...
5
by: RK | last post by:
I am getting the "HTTP /1.1 405 - method not allowed" error when I am sending XML string over Msxml2.XMLHTTP object. I am sending data in POST, also passing querystring variable and here is the...
4
by: rlr1031 | last post by:
I'm working on a project where we have to call up a URL from a Java servlet - the only sample call we have is some Javascript that used an MSXML2.XMLHTTP object to send the request, using a...
3
by: Tanmay Saxena via .NET 247 | last post by:
I used Msxml2.XMLHTTP.3.0 in mycode. It is working properly in my local and QA environment. But when i run my project on Staging environment i am getting following error. msxml3.dll: the...
3
by: BjörnHolmberg | last post by:
I'm trying to consume a WS from Excel (Office 98), seems that I can't send arguments into the WS. In order to pinpoint the problem I've written the following application i C# and VB6. It reproduces...
5
by: Brent | last post by:
This AJAX stuff is all new to me. To try it out, I borrowed this code from a website: ======================== var http_request = false; function makeRequest(url) { http_request = false;
2
by: Dave | last post by:
I am running the following code and I get an error: Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0") xmlHttp.Open "Get", URLToRSS, false xmlHttp.Send RSSXML = xmlHttp.ResponseText The...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...

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.