Gets or sets the value for the user agent header that is sent with each request.
[Visual Basic] Public Property UserAgent As String [C#] public string UserAgent {get; set;} [C++] public: __property String* get_UserAgent(); public: __property void set_UserAgent(String*); [JScript] public function get UserAgent() : String; public function set UserAgent(String);
The value of the HTTP protocol User-agent header. The default is "MS Web Services Client Protocol number ", where number is the version of the common language runtime (for example, 1.0.3705.0).
The user agent string allows a Web server to identify the client.
[Visual Basic] ' MyMath is a proxy class. Dim objMyMath As MyMath = new MyMath() ' Get the default user agent. Console.WriteLine("Default user agent is: " & objMyMath.UserAgent) objMyMath.UserAgent = "My Agent" Console.WriteLine("Modified user agent is: " & objMyMath.UserAgent) [C#] // MyMath is a proxy class. MyMath objMyMath = new MyMath(); // Get the default user agent. Console.WriteLine("Default user agent is: " + objMyMath.UserAgent); objMyMath.UserAgent = "My Agent"; Console.WriteLine("Modified user agent is: " + objMyMath.UserAgent);
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET
HttpWebClientProtocol Class | HttpWebClientProtocol Members | System.Web.Services.Protocols Namespace | UserAgent