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

  • SEARCH
  • Home
  • 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 946619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:56:52+00:00 2026-05-15T22:56:52+00:00

I have a ASP.NET (C#) web page which utilizes a VB class library. The

  • 0

I have a ASP.NET (C#) web page which utilizes a VB class library. The VB library performs a SOAP POST to a remote web service and returns a message. However the VB library keeps running into a “No connection could be made because the target machine actively refused it xxx.xxx.xxx.xxx”

However, I’ve also created a C# test client which consumes the same VB class library and can perform the post just fine!

So what is going on here?

Default.aspx:

protected void Page_Load(object sender, EventArgs e)
    {
        String soapString = ........
        MyVBMiddleTierObject.PostMgr pMgr = new MyVBMiddleTierObject.PostMgr();
        Response.Write(pMgr.DoPOST(soapString));
    }

VB Middle Tier:

Public Function DoPOST(ByVal soapMsg As String) As String
  Dim encode As UTF8Encoding = New UTF8Encoding()
  Dim buff() As Byte = encode.GetBytes(soapMsg)

  Dim client As HttpWebRequest = CType(WebRequest.Create(ConfigurationManager.AppSettings("SoapService")), HttpWebRequest)
  client.Headers.Add("SOAPAction", "")
  client.ContentType = "text/xml;charset=utf-8"
  client.Accept = "text/xml"
  client.Method = "POST"
  client.ContentLength = buff.Length
  client.Timeout = 5000

  Dim s As Stream = client.GetRequestStream()
  s.Write(buff, 0, buff.Length)
  s.Close()

  Dim response As WebResponse = client.GetResponse()
  s = response.GetResponseStream()
  Dim sr As StreamReader = New StreamReader(s)
  sPostResult = sr.ReadToEnd()
  response.Close()

  DoPOST = sPostResult

End Function

C# Test client:

class Program
    {
        static void Main(string[] args)
        {
            String soapString = ........
            MyVBMiddleTierObject.PostMgr pMgr = new MyVBMiddleTierObject.PostMgr();
            String s = pMgr.DoPOST(soapString);
            Console.WriteLine(s);
        }
    }

So why is my C# Test Client working just fine, but my web page not?

Update

Soap Message:

<soapenv:Envelope xmlns:java="java:com.xyz.service"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:vcs="http://schemas.xyz.com/vcs">
  <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1"
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken wsu:Id="UsernameToken-5775010" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility- 1.0.xsd">
        <wsse:Username>JoeShmoe</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">123456789</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>
  <soapenv:Body>
    <vcs:theirService>
      <vcs:theirMethod>
        <java:Frequency>M</java:Frequency>
      </vcs:theirMethod>
    </vcs:theirService>
  </soapenv:Body>
</soapenv:Envelope>

Again, the exact same soap string is being posted (by my test client, and by my web page) but only my test client can connect…


Update to include web.config

<configuration>
    <appSettings>
        <add key="SoapService" value="https://www.wxy.com/theirService"/>
    </appSettings>
    <connectionStrings/>
    <system.web>
        <compilation debug="true" strict="false" explicit="true"/>
        <authentication mode="Windows"/>
    </system.web>
</configuration>

It’s pretty basic…

  • 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. Editorial Team
    Editorial Team
    2026-05-15T22:56:53+00:00Added an answer on May 15, 2026 at 10:56 pm

    The error means the computer your code connected to does not have a server listening on the port you requested (80 I assume). That could mean that the IP is wrong (it found a computer, but the wrong one), or the port is wrong. We would need to see your soapString, to further diagnose.

    try putting this in your web.config to ensure credentials are passed along to your web service.

    <identity impersonate="true" />
    

    or if you are not using a windows token, just specify the userid and password.

    <identity impersonate="true"
              userName="domain\user" 
              password="password" />
    

    You also need to use a proxy with credentials.

    client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials
    

    or

    client.Proxy.Credentials = New Net.NetworkCredential("UserName", "Password")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET web page that displays a variety of fields that need
I have an asp.net web page written in C#. Using some javascript I popup
I have an ASP.NET web page with a Login control on it. When I
I have an asp.net web page with a ton of code that is handled
I have a asp.net web page with place holder control and Menu control when
I have an asp.net update web app. Users go the the page, hit the
I'm writing a web page in ASP.NET. I have some JavaScript code, and I
In ASP.net 2.0, the PreviousPage property of a web page does not have a
We have an advanced webpage (ASP.NET, C#), and a application which needs to be
I have a similar issue like here: http://social.msdn.microsoft.com/forums/en-US/biztalkgeneral/thread/87d5a6ec-04ee-4c6f-8267-f526ee105f0b I have an asp.net web page

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.