Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 51553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:46:07+00:00 2026-05-10T16:46:07+00:00

I’m trying to convert some code that worked great in VB, but I can’t

  • 0

I’m trying to convert some code that worked great in VB, but I can’t figure out what objects to use in .Net.

    Dim oXMLHttp As XMLHTTP     oXMLHttp = New XMLHTTP     oXMLHttp.open 'POST', 'https://www.server.com/path', False     oXMLHttp.setRequestHeader 'Content-Type', 'application/x-www-form-urlencoded'     oXMLHttp.send requestString  

Basically, I want to send an XML file to a server, then store the response that it returns. Can anyone point me in the right direction on this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:46:07+00:00Added an answer on May 10, 2026 at 4:46 pm

    See the following for a sample which does this: http://www.codeproject.com/KB/dotnet/NET_Interact_j2EE.aspx I have put the sample below. Sorry, I know it’s big, but you never know how long links like this will stay valid. NOTE: the first version of the question didn’t say in C# .NET – it just said ‘in .NET’. (perhaps it was tagged C# and I didn’t see it) Converting from VB.NET to C# is pretty easy (though unnecessary). ‘This class is representing the same functionality of xmlHTTP object in MSXML.XMLHTTP.

    Imports System.Net Imports System.Web.HttpUtility  Public Class XMLHTTP 'Makes an internet connection to specified URL     Public Overridable Sub open(ByVal bstrMethod As String, _      ByVal bstrUrl As String, Optional ByVal varAsync As _      Object = False, Optional ByVal bstrUser _      As Object = '', Optional ByVal bstrPassword As Object = '')        Try            strUrl = bstrUrl            strMethod = bstrMethod             'Checking if proxy configuration             'is required...(blnIsProxy value             'from config file)            If blnIsProxy Then            'Set the proxy object                proxyObject = WebProxy.GetDefaultProxy()                 'Finding if proxy exists and if so set                 'the proxy configuration parameters...                If Not (IsNothing(proxyObject.Address)) Then                    uriAddress = proxyObject.Address                    If Not (IsNothing(uriAddress)) Then                        _ProxyName = uriAddress.Host                        _ProxyPort = uriAddress.Port                    End If                    UpdateProxy()                End If                urlWebRequest.Proxy = proxyObject            End If             'Make the webRequest...            urlWebRequest = System.Net.HttpWebRequest.Create(strUrl)            urlWebRequest.Method = strMethod             If (strMethod = 'POST') Then                setRequestHeader('Content-Type', _                    'application/x-www-form-urlencoded')            End If             'Add the cookie values of jessionid of weblogic             'and PH-Session value of webseal             'for retaining the same session            urlWebRequest.Headers.Add('Cookie', str_g_cookieval)         Catch exp As Exception            SetErrStatusText('Error opening method level url connection')        End Try    End Sub    'Sends the request with post parameters...    Public Overridable Sub Send(Optional ByVal objBody As Object = '')        Try            Dim rspResult As System.Net.HttpWebResponse            Dim strmRequestStream As System.IO.Stream            Dim strmReceiveStream As System.IO.Stream            Dim encode As System.Text.Encoding            Dim sr As System.IO.StreamReader            Dim bytBytes() As Byte            Dim UrlEncoded As New System.Text.StringBuilder            Dim reserved() As Char = {ChrW(63), ChrW(61), ChrW(38)}            urlWebRequest.Expect = Nothing            If (strMethod = 'POST') Then                If objBody <> Nothing Then                    Dim intICounter As Integer = 0                    Dim intJCounter As Integer = 0                    While intICounter < objBody.Length                      intJCounter = _                        objBody.IndexOfAny(reserved, intICounter)                      If intJCounter = -1 Then UrlEncoded.Append(System.Web.HttpUtility.UrlEncode(objBody.Substring(intICounter, _                                                     objBody.Length - intICounter)))                        Exit While                      End If UrlEncoded.Append(System.Web.HttpUtility.UrlEncode(objBody.Substring(intICounter, _                                                         intJCounter - intICounter)))                      UrlEncoded.Append(objBody.Substring(intJCounter, 1))                      intICounter = intJCounter + 1                    End While                     bytBytes = _                      System.Text.Encoding.UTF8.GetBytes(UrlEncoded.ToString())                    urlWebRequest.ContentLength = bytBytes.Length                    strmRequestStream = urlWebRequest.GetRequestStream                    strmRequestStream.Write(bytBytes, 0, bytBytes.Length)                    strmRequestStream.Close()                 Else                     urlWebRequest.ContentLength = 0                End If            End If            rspResult = urlWebRequest.GetResponse()            strmReceiveStream = rspResult.GetResponseStream()            encode = System.Text.Encoding.GetEncoding('utf-8')            sr = New System.IO.StreamReader(strmReceiveStream, encode)             Dim read(256) As Char            Dim count As Integer = sr.Read(read, 0, 256)            Do While count > 0                Dim str As String = New String(read, 0, count)                strResponseText = strResponseText & str                count = sr.Read(read, 0, 256)            Loop        Catch exp As Exception            SetErrStatusText('Error while sending parameters')            WritetoLog(exp.ToString)        End Try    End Sub    'Setting header values...    Public Overridable Sub setRequestHeader(ByVal bstrHeader _                          As String, ByVal bstrValue As String)        Select Case bstrHeader             Case 'Referer'                 urlWebRequest.Referer = bstrValue             Case 'User-Agent'                 urlWebRequest.UserAgent = bstrValue             Case 'Content-Type'                 urlWebRequest.ContentType = bstrValue             Case Else                 urlWebRequest.Headers(bstrHeader) = bstrValue        End Select    End Sub     Private Function UpdateProxy()        Try            If Not (IsNothing(uriAddress)) Then                If ((Not IsNothing(_ProxyName)) And _                  (_ProxyName.Length > 0) And (_ProxyPort > 0)) Then                    proxyObject = New WebProxy(_ProxyName, _ProxyPort)                    Dim strByPass() As String = Split(strByPassList, '|')                    If strByPass.Length > 0 Then                        proxyObject.BypassList = strByPass                    End If                    proxyObject.BypassProxyOnLocal = True                    If blnNetworkCredentials Then                        If strDomain <> '' Then                            proxyObject.Credentials = New _                              NetworkCredential(strUserName, _                              strPwd, strDomain)                        Else                             proxyObject.Credentials = New _                               NetworkCredential(strUserName, _                               strPwd)                        End If                    End If                End If            End If        Catch exp As Exception            SetErrStatusText('Error while updating proxy configurations')            WritetoLog(exp.ToString)        End Try    End Function    'Property for setting the Responsetext    Public Overridable ReadOnly Property ResponseText() As String        Get            ResponseText = strResponseText        End Get    End Property     Private urlWebRequest As System.Net.HttpWebRequest    Private urlWebResponse As System.Net.HttpWebResponse    Private strResponseText As String    Private strUrl As String    Private strMethod As String    Private proxyObject As WebProxy    Private intCount As Integer    Private uriAddress As Uri    Private _ProxyName As String    Private _ProxyPort As Integer End Class 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer one option is to play with different window styles, starting… May 11, 2026 at 11:50 pm
  • Editorial Team
    Editorial Team added an answer The series of events here is supposed to work as… May 11, 2026 at 11:50 pm
  • Editorial Team
    Editorial Team added an answer Change type="button" to type="submit". May 11, 2026 at 11:50 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.