陈斌彬的技术博客

Stay foolish,stay hungry

ASP.NET 获取 Uri 各项属性值

Uri uri = new Uri("http://www.yoercn.com/aboutus/idea.html");
string Host = uri.Host;                             //www.yoercn.com
string AbsolutePath = uri.AbsolutePath;     //aboutus/idea.html
string AbsoluteUri = uri.AbsoluteUri;          //http://www.yoercn.com/aboutus/idea.html
string Authority = uri.Authority;                //www.yoercn.com
string DnsSafeHost = uri.DnsSafeHost;      //www.yoercn.com
string LocalPath = uri.LocalPath;                //aboutus/idea.html
string OriginalString = uri.OriginalString;    //http://www.yoercn.com/aboutus/idea.html
string PathAndQuery = uri.PathAndQuery;  //aboutus/idea.html
string Scheme = uri.Scheme;                    //http