How can i call an external Url from my Page in Asp.Net, How to call a URL in a web form in c# | Web Hosting | Domain Registration | Wordpress Hosting | SSL Certificates

How can i call an external Url from my Page in Asp.Net, How to call a URL in a web form in c#

using System.Net;
using System.IO; 
WebRequest req = WebRequest.Create("http://www.Website.com/MyPage.aspx?qr="+Value);
//Get the data as an HttpWebResponse object
WebResponse resp = req.GetResponse();
//Convert the data into a string (assumes that you are requesting text)
StreamReader sr = new StreamReader(resp.GetResponseStream());sr.ReadToEnd();
sr.Close();

Also set timeout of your req object as required by your application.

Regards
Asif Munir

SHARE