Want a free Ebook & latest Update Subscribe Now
  [email protected]      beta

Send webrequest with parameter in asp.net c#

C# webrequest with parameters: Here in this article will see how to pass a parameter with webrequest in asp.net c#, i.e making webrequest with some parameters.
In asp.net c# by using HttpWebRequest we create new webrequest,  and now to send parameters we use query string request.
This is how we send web requests with the parameter in asp.net c#.


The Below written code will generate web request and send with the parameter in asp.net C#.

Stream objStream;
StreamReader objSR;
System.Text.Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

string str = "http://domaninname.com/YourPage.aspx?name=" + "abc";
HttpWebRequest wrquest = (HttpWebRequest)WebRequest.Create(str);
HttpWebResponse getresponse = null;
getresponse = (HttpWebResponse)wrquest.GetResponse();

objStream = getresponse.GetResponseStream();
objSR = new StreamReader(objStream, encode, true);
string strResponse = objSR.ReadToEnd();

Hope you enjoy reading this article.

Satinder Singh

Hi all, am Founder and Author of Codepedia.info, also atypical polyglot programmer from Bombay, India. I have a passion to create, solve, and deploy software applications.
       ForEach ( minute in MyLife ) { myExperience++ ; }

Post Comment

Your email address will not be published. Required fields are marked *