简体   繁体   English

从C#地址栏中获取URL

[英]Get URL from address bar in c#

Am working in asp.net and had to rewrite some urls rewriting is working fine here is an example I had to change URL mywebsite.com/search.aspx?cat=1 to mywebsite.com/search/cameras and it's working fine now I have to change page meta tags and when I try to get url by using 我在asp.net中工作,不得不重写一些url,重写工作正常,这是一个示例,我不得不将URL mywebsite.com/search.aspx?cat=1更改为mywebsite.com/search/cameras,并且现在可以正常工作了必须更改页面元标记,当我尝试通过使用获取URL时

HttpContext.Current.Request.Url.PathAndQuery 

am getting search.aspx?cat=1 正在获取search.aspx?cat=1

while I want here is address written in address bar which is search/cameras if it's not possible than is there any way to set meta tags for specific pages? 我想在这里将地址写在地址栏中,该地址是搜索/摄像头,是否不可能为特定页面设置元标记? here is code for url rewrite 这是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;
}

HttpContext.Current.Request.RawUrl

As received by IIS prior to any manipulation. 由IIS进行任何操作之前接收。 Request.RawUrl vs. Request.Url Request.RawUrl与Request.Url

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM