using System;
public class parseURL {
public static void Main(string[] args) {
Uri uri = new Uri("https://www.collectivesolver.com:8080/Home/Index.htm?q1=abc&q2=xyz#FragmentName");
Console.WriteLine($"AbsolutePath: {uri.AbsolutePath}");
Console.WriteLine($"AbsoluteUri: {uri.AbsoluteUri}");
Console.WriteLine($"DnsSafeHost: {uri.DnsSafeHost}");
Console.WriteLine($"Fragment: {uri.Fragment}");
Console.WriteLine($"Host: {uri.Host}");
Console.WriteLine($"HostNameType: {uri.HostNameType}");
Console.WriteLine($"IdnHost: {uri.IdnHost}");
Console.WriteLine($"IsAbsoluteUri: {uri.IsAbsoluteUri}");
Console.WriteLine($"IsDefaultPort: {uri.IsDefaultPort}");
Console.WriteLine($"IsFile: {uri.IsFile}");
Console.WriteLine($"IsLoopback: {uri.IsLoopback}");
Console.WriteLine($"IsUnc: {uri.IsUnc}");
Console.WriteLine($"LocalPath: {uri.LocalPath}");
Console.WriteLine($"OriginalString: {uri.OriginalString}");
Console.WriteLine($"PathAndQuery: {uri.PathAndQuery}");
Console.WriteLine($"Port: {uri.Port}");
Console.WriteLine($"Query: {uri.Query}");
Console.WriteLine($"Scheme: {uri.Scheme}");
Console.WriteLine($"Segments: {string.Join(", ", uri.Segments)}");
Console.WriteLine($"UserEscaped: {uri.UserEscaped}");
Console.WriteLine($"UserInfo: {uri.UserInfo}");
}
}
/*
run:
AbsolutePath: /Home/Index.htm
AbsoluteUri: https://www.collectivesolver.com:8080/Home/Index.htm?q1=abc&q2=xyz#FragmentName
DnsSafeHost: www.collectivesolver.com
Fragment: #FragmentName
Host: www.collectivesolver.com
HostNameType: Dns
IdnHost: www.collectivesolver.com
IsAbsoluteUri: True
IsDefaultPort: False
IsFile: False
IsLoopback: False
IsUnc: False
LocalPath: /Home/Index.htm
OriginalString: https://www.collectivesolver.com:8080/Home/Index.htm?q1=abc&q2=xyz#FragmentName
PathAndQuery: /Home/Index.htm?q1=abc&q2=xyz
Port: 8080
Query: ?q1=abc&q2=xyz
Scheme: https
Segments: /, Home/, Index.htm
UserEscaped: False
UserInfo:
*/