Link to home
Start Free TrialLog in
Avatar of jkurant
jkurantFlag for United States of America

asked on

Why can't I instantiate an HttpRequest from my Windows client app in c#?

All I want to do is call a URL as an httpRequest using the GET method and get a string back. I have

using System.Web

but I cannot declare

System.Web.HttpRequest request = new ...

what gives? Isn't this the most basic thing? I don't get it.
Avatar of jkurant
jkurant
Flag of United States of America image

ASKER

Assuming there will be questions, I will answer some in advance. I am going to call a webservice provided by a Lotus Notes / Domino application which I also wrote. I am not very clear on exactly how to set up a proper webservice in Domino, but I know that if you point your browser to my URL, you will get back some XML with the proper headers (text/xml) so the browser displays it as XML. I don't want to use POST, just GET.
Avatar of kaufmed
Did you add a reference to System.Web?
Avatar of jkurant

ASKER

I didn't know I needed to add a reference, but having done that, I see that I can now declare the instance of the HttpRequest object. But why does it want a filename? I haven't gotten it to work yet.
I think what you are looking for is System.Net.HttpWebRequest, not HttpRequest.
using System.Net;

...

HttpWebRequest request = HttpWebRequest.Create("http://www.example.com");

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Divinity
Divinity

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jkurant

ASKER

That's all I needed! Thanks!