Uri.UserInfo Uri.UserInfo Uri.UserInfo Uri.UserInfo Property


Gets the user name, password, or other user-specific information associated with the specified URI.

 property System::String ^ UserInfo { System::String ^ get(); };
public string UserInfo { get; }
member this.UserInfo : string
Public ReadOnly Property UserInfo As String

Property Value

A String that contains the user information associated with the URI. The returned value does not include the '@' character reserved for delimiting the user information part of the URI.


This instance represents a relative URI, and this property is valid only for absolute URIs.


The following example creates a Uri instance and writes the user information to the console.

Uri^ uriAddress = gcnew Uri( "http://user:password@www.contoso.com/index.htm " );
Console::WriteLine( uriAddress->UserInfo );
Console::WriteLine( "Fully Escaped {0}",
   uriAddress->UserEscaped ? (String^)"yes" : "no" );
Uri uriAddress = new Uri ("http://user:password@www.contoso.com/index.htm ");
Console.WriteLine("Fully Escaped {0}", uriAddress.UserEscaped ? "yes" : "no");
Dim uriAddress As New Uri("http://user:password@www.contoso.com/index.htm ")
Console.WriteLine("Fully Escaped {0}", IIf(uriAddress.UserEscaped, "yes", "no")) 'TODO: For performance reasons this should be changed to nested IF statements


The value returned by this property is usually in the format "userName:password".

Applies to