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 858677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:34:27+00:00 2026-05-15T08:34:27+00:00

Okay, we’ve got an application which consists of a website hosting several ASMX webservices,

  • 0

Okay, we’ve got an application which consists of a website hosting several ASMX webservices, and a handheld application running on WinMo 6.1 which calls the webservices.

Been developing in the office, everything works perfect.

Now we’ve gone to install it at the client’s and we got all the servers set up and the handhelds installed. However the handhelds are now no longer able to connect to the webservice.

I added in extra code in my error handler to specifically trap WebException exceptions and handle them differently in the logging to put out extra information (.Status and .Response).

I am getting out the status, which is returning a [7], or ProtocolError. However when I try to read out the ResponseStream (using WebException.Response.GetResponseStream), it is returning a stream with CanRead set to False, and I thus am unable to get any further details of what is going wrong.

So I guess there are two things I am asking for help with…

a) Any help with trying to get more information out of the WebException?

b) What could be causing a ProtocolError exception?

Things get extra complicated by the fact that the client has a full-blown log-in-enabled proxy setup going on-site. This was stopping all access to the website initially, even from a browser. So we entered in the login details in the network connection for HTTP on the WinMo device. Now it can get to websites fine.

In fact, I can even pull up the webservice fine and call the methods from the browser (PocketIE). So I know the device is able to see the webservices okay via HTTP. But when trying to call them from the .NET app, it throws ProtocolError [7].

Here is my code which is logging the exception and failing to read out the Response from the WebException.

Public Sub LogEx(ByVal ex As Exception)
    Try
        Dim fn As String = Path.Combine(ini.CorePath, "error.log")
        Dim t = File.AppendText(fn)
        t.AutoFlush = True
        t.WriteLine(<s>===== <%= Format(GetDateTime(), "MM/dd/yyyy HH:mm:ss") %> =====<%= vbCrLf %><%= ex.Message %></s>.Value)
        t.WriteLine()
        t.WriteLine(ex.ToString)
        t.WriteLine()
        If TypeOf ex Is WebException Then
            With CType(ex, WebException)
                t.WriteLine("STATUS: " & .Status.ToString & " (" & Val(.Status) & ")")
                t.WriteLine("RESPONSE:" & vbCrLf & StreamToString(.Response.GetResponseStream()))
            End With
        End If
        t.WriteLine("=".Repeat(50))
        t.WriteLine()
        t.Close()
    Catch ix As Exception : Alert(ix) : End Try
End Sub

Private Function StreamToString(ByVal s As IO.Stream) As String
    If s Is Nothing Then Return "No response found."

    // THIS IS THE CASE BEING EXECUTED
    If Not s.CanRead Then Return "Unreadable response found."

    Dim rv As String = String.Empty, bytes As Long, buffer(4096) As Byte
    Using mem As New MemoryStream()
        Do While True
            bytes = s.Read(buffer, 0, buffer.Length)
            mem.Write(buffer, 0, bytes)

            If bytes = 0 Then Exit Do
        Loop

        mem.Position = 0
        ReDim buffer(mem.Length)
        mem.Read(buffer, 0, mem.Length)
        mem.Seek(0, SeekOrigin.Begin)
        rv = New StreamReader(mem).ReadToEnd()

        mem.Close()
    End Using

    Return rv.NullOf("Empty response found.")
End Function

Thanks in advance!

  • 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-15T08:34:27+00:00Added an answer on May 15, 2026 at 8:34 am

    I was not able to get any more information out of the WebException class. For some reason that GetResponseStream always returns an unreadable stream.

    I was able to narrow the problem down to proxy authentication though by writing a separate little program which simply tried to request a web page and read the response and put it into a textbox.

    This program returned a response of proxy authentication required. I find this really weird though because I put the proxy information into the network connection settings on my device. I would’ve though this would apply to all network traffic going out on that connection; apparently it only applies to traffic through the browser, not application requests. Odd.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, this is the case: I got a generic base-class which I need to
Okay, simple situation: I'm writing a simple console application which connects to a SOAP
Okay this question is very simple: I have a facebook page, and a website.
Okay, I have GOT to be missing something totally rudimentary here. I have an
Okay, I've got an interesting one (well, interesting to me, anyway :) ). I've
Okay, so I've got something as simple as this: <audio autoplay='autoplay' loop='loop' id='audio' controls>
Okay so this one is stumping me. I have the following code which attempts
Okay, this might be a very silly beginner question, but: I've got an ClassA,
Okay so the basically I'm building an application to connect to xero on the
Okay I got some good advice for Mobile Detection but still having an issue

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.