System.Uri-Klasse (URL) als Beispiel
C# Frameworks · 2008-11-03 15:56
Die Dokumentation der Uri-Klasse in .Net ist nicht gerade besonders gut. Z.B. geht daraus nicht eindeutig hervor, ob Uri.Schema nun das Protokoll oder das Protokoll inc. Doppelpunkt liefert. Deswegen hier nun ein Zusammenfassung ueber alle wichtigen Eigentschaften einer Uri am Beispiel.
https://user:pass@example.org:80/page.html?param=value
| AbsolutePath | /page.html |
| AbsoluteUri | https://user:pass@example.org:80/page.html?param=value |
| Authority | example.org:80 |
| DnsSafeHost | example.org |
| Fragment | |
| Host | example.org |
| IsAbsoluteUri | True |
| IsDefaultPort | False |
| IsFile | False |
| IsLoopback | False |
| IsUnc | False |
| IsWellFormedOriginalString | True |
| LocalPath | /page.html |
| OriginalString | https://user:pass@example.org:80/page.html?param=value |
| PathAndQuery | /page.html?param=value |
| Port | 80 |
| Query | ?param=value |
| Scheme | https |
| Segments[0] | / |
| Segments[1] | page.html |
| ToString | https://user:pass@example.org:80/page.html?param=value |
| UserEscaped | False |
| UserInfo | user:pass |
file:C:/File.txt
| AbsolutePath | C:/File.txt |
| AbsoluteUri | file:///C:/File.txt |
| Authority | |
| DnsSafeHost | |
| Fragment | |
| Host | |
| IsAbsoluteUri | True |
| IsDefaultPort | True |
| IsFile | True |
| IsLoopback | True |
| IsUnc | False |
| IsWellFormedOriginalString | False |
| LocalPath | C:\File.txt |
| OriginalString | file:C:/File.txt |
| PathAndQuery | C:/File.txt |
| Port | -1 |
| Query | |
| Scheme | file |
| Segments[0] | / |
| Segments[1] | C:/ |
| Segments2 | File.txt |
| ToString | file:///C:/File.txt |
| UserEscaped | False |
| UserInfo |
ftp://127.0.0.1/file.txt
| AbsolutePath | /file.txt |
| AbsoluteUri | ftp://127.0.0.1/file.txt |
| Authority | 127.0.0.1 |
| DnsSafeHost | 127.0.0.1 |
| Fragment | |
| Host | 127.0.0.1 |
| IsAbsoluteUri | True |
| IsDefaultPort | True |
| IsFile | False |
| IsLoopback | True |
| IsUnc | False |
| IsWellFormedOriginalString | True |
| LocalPath | /file.txt |
| OriginalString | ftp://127.0.0.1/file.txt |
| PathAndQuery | /file.txt |
| Port | 21 |
| Query | |
| Scheme | ftp |
| Segments[0] | / |
| Segments[1] | file.txt |
| ToString | ftp://127.0.0.1/file.txt |
| UserEscaped | False |
| UserInfo |
— Webmaster
Kommentare
Kommentarfunktion für diesen Artikel geschlossen