如何找到给定的网址是绝对网址或相对网址 [英] How to find given url is absolute url or relative url

查看:90
本文介绍了如何找到给定的网址是绝对网址或相对网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查网址是绝对网址还是相对网址,因为我必须为这些网址执行不同的功能。



我尝试过的内容:



i want to check the url is absolute or relative url because i have to perform different function for these each one.

What I have tried:

if(Uri.TryCreate(url, UriKind.Absolute, out result))



{

}


{
}

推荐答案

看看 Uri.IsWellFormedUriString Method(String,UriKind)(System) [ ^ ]

Have a look at Uri.IsWellFormedUriString Method (String, UriKind) (System)[^]
Uri.IsWellFormedUriString(url, UriKind.Absolute)




Uri.IsWellFormedUriString(url, UriKind.Relative)


这篇关于如何找到给定的网址是绝对网址或相对网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆