Uri.UserInfo Propriedade
Definição
Obtém o nome de usuário, a senha ou outras informações específicas do usuário associado com o URI especificado.Gets the user name, password, or other user-specific information associated with the specified URI.
public:
property System::String ^ UserInfo { System::String ^ get(); };
public string UserInfo { get; }
member this.UserInfo : string
Public ReadOnly Property UserInfo As String
Valor da propriedade
As informações do usuário associadas ao URI.The user information associated with the URI. O valor retornado não inclui o caractere '@' reservado para delimitar a parte de informações de usuário do URI.The returned value does not include the '@' character reserved for delimiting the user information part of the URI.
Exceções
Esta instância representa uma URL relativa, e esta propriedade só é válida para URIs absolutos.This instance represents a relative URI, and this property is valid only for absolute URIs.
Exemplos
O exemplo a seguir cria uma Uri instância e grava as informações do usuário no console do.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(uriAddress.UserInfo);
Console.WriteLine("Fully Escaped {0}", uriAddress.UserEscaped ? "yes" : "no");
Dim uriAddress As New Uri("http://user:password@www.contoso.com/index.htm ")
Console.WriteLine(uriAddress.UserInfo)
Console.WriteLine("Fully Escaped {0}", IIf(uriAddress.UserEscaped, "yes", "no")) 'TODO: For performance reasons this should be changed to nested IF statements
Comentários
O valor retornado por essa propriedade geralmente está no formato "userName: password".The value returned by this property is usually in the format "userName:password".