メモ : このコンストラクタは、互換性のために残されています。
指定した URI を使用し、明示的な文字エスケープ制御を使用して、Uri クラスの新しいインスタンスを初期化します。
名前空間: System
アセンブリ: System (system.dll 内)
構文
'宣言
<ObsoleteAttribute("The constructor has been deprecated. Please use new Uri(string). The dontEscape parameter is deprecated and is always false. https://go.microsoft.com/fwlink/?linkid=14202")> _
Public Sub New ( _
uriString As String, _
dontEscape As Boolean _
)
'使用
Dim uriString As String
Dim dontEscape As Boolean
Dim instance As New Uri(uriString, dontEscape)
[ObsoleteAttribute("The constructor has been deprecated. Please use new Uri(string). The dontEscape parameter is deprecated and is always false. https://go.microsoft.com/fwlink/?linkid=14202")]
public Uri (
string uriString,
bool dontEscape
)
[ObsoleteAttribute(L"The constructor has been deprecated. Please use new Uri(string). The dontEscape parameter is deprecated and is always false. https://go.microsoft.com/fwlink/?linkid=14202")]
public:
Uri (
String^ uriString,
bool dontEscape
)
/** @attribute ObsoleteAttribute("The constructor has been deprecated. Please use new Uri(string). The dontEscape parameter is deprecated and is always false. https://go.microsoft.com/fwlink/?linkid=14202") */
public Uri (
String uriString,
boolean dontEscape
)
ObsoleteAttribute("The constructor has been deprecated. Please use new Uri(string). The dontEscape parameter is deprecated and is always false. https://go.microsoft.com/fwlink/?linkid=14202")
public function Uri (
uriString : String,
dontEscape : boolean
)
パラメータ
- uriString
URI。
- dontEscape
uriString が完全にエスケープされている場合は true。それ以外の場合は false。解説を参照してください。
例外
例外の種類 | 条件 |
---|---|
uriString が null 参照 (Visual Basic では Nothing) です。 |
|
uriString が空か、空白だけを含んでいます。 または uriString に指定されたスキームが無効です。 または uriString に含まれているスラッシュが多すぎます。 または uriString に指定されたパスワードが無効です。 または uriString に指定されたホスト名が無効です。 または uriString に指定されたファイル名が無効です。 または uriString に指定されたユーザー名が無効です。 または uriString に指定するホスト名または権限名の末尾には、円記号を使用できません。 または uriString に指定されたポート番号が無効であるか、解析できません。 または uriString の長さが 65534 文字を超えています。 または uriString に指定されたスキームの長さが 1023 文字を超えています。 または uriString に無効な文字シーケンスが含まれています。 または uriString に指定する MS-DOS パスは、c:\\ で始める必要があります。 |
解説
このコンストラクタは、URI 文字列から Uri インスタンスを作成します。URI を解析して正規書式に変換します。
dontEscape パラメータは、予約文字をエスケープ シーケンスに変換するかどうかを制御します。このパラメータは、URI のすべての予約文字がエスケープされていることが確実である場合だけに true に設定します。完全にエスケープされていない URL に対して値を true に設定すると、予測できない動作が発生する場合があります。このパラメータは常に false に設定することを強くお勧めします。
dontEscape を false に設定すると、コンストラクタは、すべてのパーセント記号 (%) の後に有効なエスケープ シーケンスが続いているかどうかを確認して、予約文字をすべてエスケープします。パーセント記号に続く文字シーケンスが有効でない場合は、パーセント記号が %25 に置き換えられます。
このコンストラクタを使用しても、Uri によって参照されるリソースが確実にアクセス可能であるとは限りません。
使用例
https://www.contoso.com/Hello%20World.htm という URI から Uri インスタンスを作成する例を次に示します。格納されている URI が完全にエスケープされ、正規形式になっているので、dontEscape パラメータを true に設定できます。
Dim myUri As New Uri("https://www.contoso.com/Hello%20World.htm", True)
Uri myUri = new Uri("https://www.contoso.com/Hello%20World.htm", true);
Uri^ myUri = gcnew Uri( "https://www.contoso.com/Hello%20World.htm",true );
Uri myUri = new Uri("https://www.contoso.com/Hello%20World.htm", true);
var myUri : Uri = new Uri("https://www.contoso.com/Hello%20World.htm", true);
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 1.0、1.1
2.0 では、互換性のために残されています (コンパイル時に警告)
.NET Compact Framework
サポート対象 : 1.0
2.0 では、互換性のために残されています (コンパイル時に警告)