Reputation: 6543
Hey I am trying to remove a querystring from a friendly URL i.e I have
/who-we-are/our-people.html?linkidentifier=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
Upvotes: 0
Views: 1460
Reputation: 6903
You need to use the Request
's Path
property - this article should give you everything you need: Making Sense of ASP.NET Paths
Upvotes: 0
Reputation: 9954
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;
Upvotes: 2
Reputation: 11309
You need to do URL rewriting.
Here you can find more about this click here
Upvotes: 0