Help with HttpWebRequest please !!!!

G

Guest

Ok guys, I mus be missing something because this can not be that hard.

I have an ASP page that returns a value if you issue a GET request to it
with server name and user ID

https://someserver/somedir/size.asp?server=something&user=somethingelse

Now the question is, how in the hell do I call this from a ASP.NET website
when a button is pushed.

I have been searching the net on the HttpWebRequest and have found nothing
that works. Does anyone have some sample code of this please ? It can be in
VB or C#.

I can believe something I can do in 3 lines of JScript or VB script can be
so hard in managed code.
 
J

Joerg Jooss

Thus wrote Chris,
Ok guys, I mus be missing something because this can not be that hard.

I have an ASP page that returns a value if you issue a GET request to
it with server name and user ID

https://someserver/somedir/size.asp?server=something&user=somethingels
e

Now the question is, how in the hell do I call this from a ASP.NET
website when a button is pushed.

I have been searching the net on the HttpWebRequest and have found
nothing that works. Does anyone have some sample code of this please ?
It can be in VB or C#.

I can believe something I can do in 3 lines of JScript or VB script
can be so hard in managed code.

Assuming you want to send the request from your ASP.NET page's code-behind
class, and ignoring stuff like SSL certificates, web proxies, etc. it boils
down to

// using System.Net;

WebClient client = new WebClient();
string html = client.DownloadString(url);

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top