ASP.NET Removing Querystring from friendly URL
Hey I am trying to remove a querystring from a friendly URL i.e I have
/who-we-are/our-people.html?linkident开发者_开发百科ifier=id&itemid=42
And I want to change the above to
/who-we-are/our-people.html
How can I remove anything after the .html
Fastest way to do it reliably is to use the System.Uri
class:
string pathOnly = new Uri("http://whatever.com/who-we-are/our-people.html?linkidentifier=id&itemid=42").AbsolutePath;
You need to do URL rewriting.
Here you can find more about this click here
You need to use the Request
's Path
property - this article should give you everything you need: Making Sense of ASP.NET Paths
精彩评论