If you just want to replace the anchor part use string operations. They are simpler and faster
var parts = "http://someurl.com#hashpart".Split("#");
// yields "http://someurl.com" and "hashpart" as array.
// you may want to check if the result has length of two
// if it does :
var newUrl = string.Format("{0}#{1}" parts[0], "some replacement for hashpart");
If your URL contains multiple hashes try using string.Substring to split at the first hashtag.
var url = "http://someurl.com#hash#hashhash";
var hashPos = url.IndexOf("#");
var urlPart = url.Substring(hashPos);
var hashPart = url.Substring(hashPos +1, url.length - hashPos -1);
Should work, wrote it without verification, maybe you have to toss around some +/- 1 to get the right positions.