如何检查URL是否是外部链接



如果URL ADRESS是外部链接,则需要在剃须刀视图中检查。Web本地URL为:http://test.web.tt和http://localhtost。我想在新窗口中打开所有外部链接。

外部链接是从网站到另一个网站的链接。

示例:
http://test.web.tt/about .. local
http://localhtost/of .. local
以上两个链接都是本地的(网站上的同一页面,同一主机上,只有不同的URL -DNS名称)

谢谢

 if(Request.IsLocal)
 {
      //do whatever you want here
 }

您只需要检查当前请求的ISLOCAL属性。

如果我有帮助,请标记为答案。

最新更新