string strId = "regid789654"; string strName = "Charith"; 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();
Friday, June 04, 2010
How to post values to diffent page using HttpWebRequest : Asp.net
Using Asp.net HttpWebRequest object we can post data to external page and get a HttpWebResponse
Subscribe to:
Post Comments (Atom)
Azure Storage Account Types
Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...
-
Why we need asynchronous tasks? Execute a time consuming operations in parallel to the CLR thread which execute the request If you have ...
-
Demo: I was thinking a way to show images before actually uploading them to server. I would say to preview images using javascript. Obv...
No comments:
Post a Comment