0

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

3 Answers 3

2

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;
Sign up to request clarification or add additional context in comments.

1 Comment

How can i just replace the url in the address bar with pathOnly?
0

You need to do URL rewriting.

Here you can find more about this click here

Comments

0

You need to use the Request's Path property - this article should give you everything you need: Making Sense of ASP.NET Paths

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.