Reputation: 315
For example, I have an ASP.NET form that is called by another aspx:
string url = "http://somewhere.com?P1=" + Request["param"];
Response.Write(url);
I want to do something like this:
string url = "http://somewhere.com?P1=" + Request["param"];
string str = GetResponse(url);
if (str...) {}
I need to get whatever Response.Write is getting as a result or going to url, manipulate that response, and send something else back.
Any help or a point in the right direction would be greatly appreciated.
Upvotes: 3
Views: 5387
Reputation: 315
WebClient.DownloadString totally did the trick. I got myself too wrapped up in this one.. I was looking at HttpModule and HttpHandler, when I had used WebClient.DownloadFile in the past.
Thank you very much to all who've replied.
Upvotes: 0
Reputation: 8670
An HttpResponse is something that is sent back to the client in response to an HttpRequest. If you want process something on the server, then you can probably do it with either a web service call or a page method. However, I'm not totally sure I understand what you're trying to do in the first place.
Upvotes: 0
Reputation: 77657
You will need to use the HttpWebRequest and HttpWebResponse objects. You could also use the WebClient object
Upvotes: 1
Reputation: 78152
WebClient client = new WebClient();
string response = client.DownloadString(url);
Upvotes: 8