Here is the way you can get the new URL from current one :-
Ex
string all = "www.w3schools.com/Asp/sample.aspx";
string part = all.Substring(0, all.LastIndexOf('/'));
string part1 = part.Substring(0, part.LastIndexOf('/'));
string part2 = all.Substring(all.LastIndexOf('/'), all.Length-part.Length);
string newURL = part1 + part2;
If you want to get the current URL dynamically then you can get like mentioned here in this post :-
http://forums.asp.net/t/1422355.aspx?Get+current+URL+in+ASP+NET[
^]