When I downloaded content from my C # application to a website in the past, I used a POST request as follows:
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http://" + this.server + "/log.php"); wr.Method = "POST"; wr.ContentType = "application/x-www-form-urlencoded"; string paramString = "v=" + this.version + "&m=" + this.message; wr.ContentLength = paramString.Length; StreamWriter stOut = new StreamWriter(wr.GetRequestStream(), System.Text.Encoding.ASCII); stOut.Write(paramString); stOut.Close();
My problem is that now I am in a situation where this.message will most likely contain newlines, tabs and special characters, including "&" and "=". Do I need to avoid this content. If so, how?
Andrew Ensley
source share