gpt4 book ai didi

c# - 检查 url 是否在域名后有任何内容

转载 作者:太空宇宙 更新时间:2023-11-03 11:48:48 24 4
gpt4 key购买 nike

我正在使用 asp.net c#。

我想查看当前url域名后面有没有什么

例如,如果当前 url

www.example.com/

www.example.com

我想将 bool 值设置为真。如果它有任何东西,我想将它设置为 false。例如

www.example.com/stuff

我该怎么做?

应该返回 false。

最佳答案

类似于:

bool isRoot = new Uri("http://www.example.com").AbsolutePath == "/";

关于c# - 检查 url 是否在域名后有任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2638831/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com