[Mono-bugs] [Bug 81104][Min] New - System.Net.WebClient.DownloadString ignores "Query" property

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Mar 10 09:06:15 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mickael9 at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81104

--- shadow/81104	2007-03-10 09:06:15.000000000 -0500
+++ shadow/81104.tmp.18398	2007-03-10 09:06:15.000000000 -0500
@@ -0,0 +1,67 @@
+Bug#: 81104
+Product: Mono: Class Libraries
+Version: 1.2
+OS: Windows XP
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: mickael9 at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Net.WebClient.DownloadString ignores "Query" property
+
+When you use the System.Net.WebClient.DownloadString method, the 
+QueryString property is ignored, you have to put GET variables in the URI.
+
+Actual Results:
+QueryString property is ignored
+
+Expected Results:
+QueryString property should be used as query string
+
+
+Test :
+
+using System;
+using System.Net;
+
+namespace Test
+{
+	class Program
+	{
+		[STAThread]
+		static void Main()
+		{
+			WebClient objClient = new WebClient();
+			objClient.QueryString.Add("q", "test");
+			objClient.QueryString.Add("hl", "en");
+
+			string strResult = objClient.DownloadString(new 
+Uri("http://www.google.com/search"));
+			
+			// Get the page's title
+			int intPosTitle  = strResult.IndexOf("<title>") + 
+7;
+			int intPosEnd    = strResult.IndexOf("</title>");
+			string strTitle  = 
+strResult.Substring(intPosTitle, intPosEnd - intPosTitle);
+
+			/* Mono               : Google
+			 *                uri : http://www.google.com/
+search
+			 *
+			 * Microsoft .NET 2.0 : test - Google Search
+			 *                uri : http://www.google.com/
+search?q=test&hl=en
+			 */
+
+			Console.WriteLine("Title : {0}", strTitle);
+		}
+	}
+}


More information about the mono-bugs mailing list