Uri.UserInfo Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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


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.


Exception Condition

This property is valid only for an absolute Uri instance.


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


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
  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";
            outputBlock.Text += "Fully Escaped no\n";

Uri uriAddress = new Uri ("http://user:password@www.contoso.com/index.htm ");
Console.WriteLine("Fully Escaped {0}", uriAddress.UserEscaped ? "yes" : "no");

Version Information


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also