HttpWebClientProtocol.UserAgent Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the value for the user agent header that is sent with each request.
public:
property System::String ^ UserAgent { System::String ^ get(); void set(System::String ^ value); };
public string UserAgent { get; set; }
[System.ComponentModel.Browsable(false)]
public string UserAgent { get; set; }
member this.UserAgent : string with get, set
[<System.ComponentModel.Browsable(false)>]
member this.UserAgent : string with get, set
Public Property UserAgent As String
Property Value
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).
- Attributes
Examples
// MyMath is a proxy class.
test::MyMath^ objMyMath = gcnew test::MyMath;
// Get the default user agent.
Console::WriteLine( "Default user agent is: {0}", objMyMath->UserAgent );
objMyMath->UserAgent = "My Agent";
Console::WriteLine( "Modified user agent is: {0}", objMyMath->UserAgent );
// 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);
' 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)
Remarks
The user agent string allows a Web server to identify the client.
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET