首页 > 开发 > .Net > 正文

Request.RawUrl 属性的应用收

2020-04-24 22:09:53
字体:
来源:转载
供稿:网友
原始 URL 定义为 URL 中域信息之后的部分。在 URL 字符串 http://www.contoso.com/articles/recent.aspx 中,原始 URL 为 /articles/recent.aspx。原始 URL 包括查询字符串(如果存在)。
代码如下:
if (Request.RawUrl.ToLowerInvariant().Contains("/category/"))
{
DisplayCategories();
}

用来对字符串分析,有选择的导向。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表