string strId = "userid"; string strName = "cherukattu"; ASCIIEncoding encoding = new ASCIIEncoding(); string postData = "userid=" + strId; postData += ("&username=" + strName); byte[] data = encoding.GetBytes(postData); HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.domain.com/cart.asp"); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; Stream newStream = request.GetRequestStream(); newStream.Write(data, 0, data.Length); newStream.Close(); StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream()); string result = sr.ReadToEnd(); sr.Close();
CHERUKATTU GROUP is a social helping web blog simply dedicated for technology and encouragement of talented seeds.
Search This Blog
POST VALUES TO ASP.NET PAGES USING HttpWebRequest
Using Asp.net HttpWebRequest object we can post data to external page and get a HttpWebResponse
Subscribe to:
Comments (Atom)