Author: ghena_t | Posted on: 10/12/2009 12:41:30 AM | Views : 247

Dear All,
I am trying to POST data from a console application using HttpWebRequest/HttpWebResponse to a blank ASP.NET page (page does not contain any web control or UI). Only action that will be performed by the aspx is forwarding(redirecting) posted data to another location.
Console application contains the following code:

public static void Main(string[] args) { try { string postData = string.Concat("requestXML=","Test data to send"); byte[] dataToSend = Encoding.Default.GetBytes(HttpUtility.UrlEncode(postData)); HttpWebRequest httpRequest = WebRequest.Create(_host) as HttpWebRequest; httpRequest.Method = WebRequestMethods.Http.Post; httpRequest.ContentType = @"application/x-www-form-urlencoded; charset=UTF-8"; httpRequest.CookieContainer = new CookieContainer(); httpRequest.ContentLength = dataToSend.Length; using (Stream postDataStre ...

Go to the complete details ...