Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检查当前路径是否为以下路径之一
http://sitename/dirname3/file1.aspx http://sitename/dirname3/myfile.aspx
...
使用正则表达式。
我知道如何获取当前路径,即
string currentUrl = HttpContext.Current.Request.Url.AbsoluteUri;
为什么要使用正则表达式,而不仅仅是例如
HttpContext.Current.Request.Url.AbsoluteUri.StartsWith(pathToCheck);
?