Solved

VB.Net Web Client and paramaters

Posted on 2013-06-06
9
410 Views
Last Modified: 2013-06-10
My following snippett creates no errors


But I need to pass in a paramater "command" to the url.

How would I do that?

        Dim Client As New WebClient
        Using Client
            Dim reader As New StreamReader(Client.OpenRead("https://hostedconnect.m5net.com/bobl/bobl"), Encoding.UTF8, True)
            Dim line As String = reader.ReadLine()
            Do While line IsNot Nothing
                Debug.WriteLine(line)
                line = reader.ReadLine()
            Loop
        End Using

Open in new window

0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
9 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39226685
How does that resource expect its parameters to be received? Via a POST? A GET? For the latter you might try appending a query string:

Dim reader As New StreamReader(Client.OpenRead("https://hostedconnect.m5net.com/bobl/bobl?command=commandValue"), Encoding.UTF8, True)

Open in new window


...For the former, you'll need to use a different method than OpenRead.
0
 

Author Comment

by:lrbrister
ID: 39226803
kaufmed
This is tied toa very difficult project I'm on

I need to POST XML to a url

I then need to get the response...and keep the connection OPEN because this url I'm posting to will send an unlimited stream of data back to me.
The POST comes back with a reply

A few seconds later another block of data will come back

And then as certain events take place in our system...
THEY will send additional data
0
 

Author Comment

by:lrbrister
ID: 39235329
Thanks
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 25

Accepted Solution

by:
kevp75 earned 500 total points
ID: 39235357
Hello,
Yes, you will need to change the way you are accessing the service.  WebClient does not have enough features in it's classes and interfaces to do what you need, it's simply a (no offense intended) lazy-man's approach to making a simple GET request.

http://msdn.microsoft.com/en-us/library/vstudio/ba0z6a33(v=vs.100).aspx

http://stackoverflow.com/questions/14964766/posting-xml-to-web-service-in-net-c-sharp-and-recieving-response

Will show you how to do this.
0
 

Author Comment

by:lrbrister
ID: 39235412
kevp75
  Let me review what you posted.

And absolutely no offense taken.  I am NOT experienced in what I'm trying to do here. You guys are the experts.

And oh yeah...to get answers I am not above groveling :-)
0
 

Author Closing Comment

by:lrbrister
ID: 39235447
Thanks
0
 
LVL 25

Expert Comment

by:kevp75
ID: 39235537
:) Any time, glad I could help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question