获取原始url

本文关键字:url 原始 获取 | 更新日期: 2023-09-27 18:16:37

我正在重写URL,因为我想获得原始URL。当用户请求以下url时:http://test.acom/test12.htm这个请求的原始url在

下面

http://test.acom/cms.aspx?pid=123 when

现在我想找出原始的url

获取原始url

您可以使用Request.RawUrl获得客户端最初请求的URL。此URL始终是相对的,因此在您的情况下,它将读取/test12.htm

以下作品为我Request.Url

我使用自定义重写url类,将url从articles/displayarticle.aspx?ArticleID=73更改为articles/Build-a-file-tree-explorer-with-jQuery-and-ASP.NET.aspx

注意这也是一个webforms网站。

request.url一起得到articles/displayarticle.aspx?ArticleID=73