Click here to Skip to main content
13,087,941 members (65,784 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Uri address = new Uri("");
            // Create the web request
            HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
            // Set type to POST
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            // Create the data we want to send
            string appId = "test";
            string password = "8lissgroup";
            StringBuilder data = new StringBuilder();
            data.Append("appid=" + HttpUtility.UrlEncode(appId));
            data.Append("&context=" + HttpUtility.UrlEncode(password));
            // Create a byte array of the data we want to send
            byte[] byteData = UTF8Encoding.UTF8.GetBytes(data.ToString());
            // Set the content length in the request headers
            request.ContentLength = byteData.Length;
            // Write data
            using (Stream postStream = request.GetRequestStream())
                postStream.Write(byteData, 0, byteData.Length);
            // Get response
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                // Get the response stream
                StreamReader reader = new StreamReader(response.GetResponseStream());
                // Console application output
                Console.WriteLine(reader.ReadToEnd());           }

i use above code and it returns internal server error(500) in response
Posted 18-Oct-12 0:41am
Updated 18-Oct-12 1:31am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 18 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100