从c#中的地址栏获取网址

问题描述 投票:0回答:1

我在asp.net工作,不得不重写一些网址重写工作正常这里是一个例子,我不得不将URL mywebsite.com/search.aspx?cat=1更改为mywebsite.com/search/cameras,它现在工作正常我必须更改页面元标记,当我尝试通过使用获取网址时

HttpContext.Current.Request.Url.PathAndQuery 

我正在获得search.aspx?cat=1

虽然我想在这里写的是地址栏中的地址,这是搜索/相机,如果不可能有任何方法为特定页面设置元标记?这是url重写的代码

m_boolIsCustomPage = true;

m_strPageBaseUrl = "search.aspx";
if (m_intIDSearch > -1)
{
    l_strQueryContents = m_intIDSearch.ToString();
    m_intIDSearch = -1;
}
else
{
    l_strQueryContents = "-1";
    m_intIDSearch = -1;
}
c# asp.net webforms code-behind
1个回答
0
投票

HttpContext.Current.Request.RawUrl

在任何操作之前由IIS收到。 Request.RawUrl vs. Request.Url

© www.soinside.com 2019 - 2024. All rights reserved.