locked
Having problem with Motolora MC75A RRS feed

  • Question

  • User1688459555 posted

    Hello
    I developed which is supposed to connect with a web page supplier a value on a php page in which that page gives data in return, I tested it on my computer it is working very well.
    But when I deployed it it doesnt process anywhere that has to do with database.
    But If I paste on the browser it does fine but the phone couldnt.

    Below is the code

       Public Shared Function StringFromURL(ByVal URL As String) As String
            Try

                Dim sr As System.IO.StreamReader = New System.IO.StreamReader(StreamFromURL(URL))
                Dim f As String = sr.ReadToEnd()
                sr.Dispose()
                Return f

            Catch ex As Exception
                Return "1"
            End Try

        End Function

        Private Shared Function StreamFromURL(ByVal URL As String) As System.IO.Stream

            Dim wReq As Net.WebRequest
            wReq = WebRequest.Create(URL)
            wReq.Timeout = 1020000
            wReq.PreAuthenticate = True
            Dim wres As WebResponse = wReq.GetResponse
            Return wres.GetResponseStream

        End Function

    No error but it would never fetch the record from the web for me though if I copy the same url and paste it on the web it will process.

    Please who can tell me why?
    Thanks

    Saturday, September 1, 2012 1:56 PM

All replies

  • User753101303 posted

    Hi,

    And StringFromURL is called from? Do you check the return value? Turning an exception into a return value is often considered bad as it make easy to unintentionally hide exceptions or misinterpret what actually happens.

    Before reading the code you should always first find what actually happens.

    Monday, December 4, 2017 10:20 AM