Uri.UserInfo Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

Namespace: System
Assembly: System (in System.dll)

Syntax

Public ReadOnly Property UserInfo As String
public string UserInfo { get; }

Property Value

Type: System..::.String
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.

Exceptions

Exception Condition
InvalidOperationException

This property is valid only for an absolute Uri instance.

Remarks

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

Examples

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

Dim uriAddress3 As Uri = New Uri ("http://user:password@www.contoso.com/index.htm ")
outputBlock.Text &= uriAddress3.UserInfo
outputBlock.Text &= vbCrLf

If uriAddress.UserEscaped Then
  outputBlock.Text &= "Fully Escaped yes"
  outputBlock.Text &= vbCrLf
Else
  outputBlock.Text &= "Fully Escaped no"
  outputBlock.Text &= vbCrLf
End If
        Uri uriAddress3 = new Uri ("http://user:password@www.contoso.com/index.htm ");
        outputBlock.Text += uriAddress3.UserInfo;
        outputBlock.Text += "\n";

        if (uriAddress.UserEscaped)
            outputBlock.Text += "Fully Escaped yes\n";
        else    
            outputBlock.Text += "Fully Escaped no\n";

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

Uri Class

System Namespace