Equivalent of .Net Code in VBScript

Hi ,

I need to have VBScript equivalent code for below .Net code. Kindly let me know how to go about this.

  Public Sub UploadFile(ByVal localFile As String, ByVal uploadUrl As String)

        Try
            Dim ByPassUrls() As String
            Dim loNetworkCredentials As NetworkCredential

            loNetworkCredentials = New NetworkCredential(Util.GetSetting("NetworkCredentialUserid"), _
                                                     Util.GetSetting("NetworkCredentialPassword"), _
                                                     Util.GetSetting("NetworkCredentialDomain"))

            Dim proxy As New WebProxy(Util.GetSetting("WebProxyName"), _
                                    Util.GetSetting("WebProxyPortNumber"), ByPassUrls, loNetworkCredentials)

            Dim req As HttpWebRequest
            req = WebRequest.Create(uploadUrl)

            req.Method = "POST"
            req.Proxy = proxy
            req.Credentials = loNetworkCredentials

            req.AllowWriteStreamBuffering = True

            req.ContentType = "application/x-wmflatfile"

            Dim reqStream As Stream

            reqStream = req.GetRequestStream()
            Dim wrtr As StreamWriter
            wrtr = New StreamWriter(reqStream)

            Dim rdr As StreamReader

            rdr = New StreamReader(localFile)

            Dim inLine As String

            inLine = rdr.ReadLine()

            While inLine <> ""
                wrtr.WriteLine(inLine)
                inLine = rdr.ReadLine()
            End While

            rdr.Close()

            wrtr.Close()
            Dim objResponse As WebResponse
            objResponse = req.GetResponse()

            Dim result As String
            Dim sr As StreamReader
            sr = New StreamReader(objResponse.GetResponseStream())
            result = sr.ReadToEnd()
            sr.Close()

        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

    End Sub
LVL 5
Alok-AgarwalAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alok-AgarwalAuthor Commented:
Basically I am trying to understand if there are equivalent objects in VBScript corresponding to objects that have been used in the above sub.
cubaman_24Commented:
It would be something like this.
Best regards.
sub get_html (up_http, down_http)
dim xmlhttp
set xmlhttp = createobject("msxml2.xmlhttp.3.0")
xmlhttp.open "get", up_http, false
xmlhttp.send

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alok-AgarwalAuthor Commented:
Hi,

Thanks for the inputs. Is it possible to provide more details. Sorry , but I am not able to understand from the above few lines how the achieve the complete functionality that I provided in my original post.

Thanks
cubaman_24Commented:
Hello:
I gave you the points to start doing you job.But I'm not going to do it for you ;-)
Read the documentation about xmlhttp objects and its methods here
http://msdn.microsoft.com/en-us/library/ms535874%28v=vs.85%29.aspx

Best regards.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.