Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Convert VB Script to C# script with MSXML2 request: Server.CreateObject("MSXML2.ServerXMLHTTP")

Posted on 2004-11-28
3
Medium Priority
?
848 Views
Last Modified: 2012-05-05
Hi,
I know C#, but not VB.  
How do I create the equivalent C# script for this VB Syntax?

Set xml Server.CreateObject("MSXML2.ServerXMLHTTP")

Thanks

complete function is here. but I can do the rest out, once I get the correct Objects set up.


<%
Function GetContent(url)
    Dim xmlHttp
    Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
    xml.Open "GET", url, True
    Call xml.Send()

      If xml.readyState <> 4 Then
        xml.waitForResponse 3
    End If
   
     If Err.Number <> 0 Then
    Else
         If (xml.readyState <> 4) Or (xml.Status <> 200) Then
              xml.Abort
              strData = "Problem communicating with remote server..."
         Else
              strData = xml.ResponseText
         End If
    End If
    GetContent = strData
End Function
%>

<%=GetContent("http://oldlook.experts-exchange.com/")%>

0
Comment
Question by:paygo
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 2000 total points
ID: 12692213
I may be very wrong about this as I don't know much about .Net yet and even less about C#, but is this what you need?

string postData = "";
string uriString = "http://www.FairfieldConsulting.com";
string strXML ;

XMLHTTPClass xmlHTTP = new XMLHTTPClass();

xmlHTTP.open("POST", uriString,false,null,null) ;
xmlHTTP.send(postData) ;

while(xmlHTTP.readyState != 4)
     {
     }
               
strXML = (string)xmlHTTP.responseText;
0
 

Author Comment

by:paygo
ID: 12697447
Thanks fritz this is correct.

But I get a MSXML4.dll  access denied error with some sites.

This is another post question I believe
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12697539
Thank you and best of luck. Don't forget, we have an ASP.Net area--you might have better luck finding your answer there.

FtB
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question