473,387 Members | 1,313 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,387 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 11255
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.