C# WebClient QueryString

Description

WebClient QueryString Gets or sets a collection of query name/value pairs associated with the request.

Syntax

WebClient.QueryString has the following syntax.


public NameValueCollection QueryString { get; set; }

Example

Gets or sets a collection of query name/value pairs associated with the request.


using System;// w w  w . j  a  va2s .c om
using System.Net;
using System.Net.Sockets;
using System.Collections.Specialized;

public class Example
{
    public static void Main()
    {
        string uriString = "http://www.google.com/search";

        WebClient myWebClient = new WebClient();

        NameValueCollection myQueryStringCollection = new NameValueCollection();

        myQueryStringCollection.Add("q", "HTML");

        myWebClient.QueryString = myQueryStringCollection;

        myWebClient.DownloadFile(uriString, "searchresult.htm");

    }
}




















Home »
  C# Tutorial »
    System.Net »




Cookie
Dns
IPAddress
IPEndPoint
IPHostEntry
WebClient