Remove anchor from URL MVC3

786 Views Asked by At

So, I have a form on PageA that attaches an anchor so that the page jumps to errors shown on PageA. But, when there are no errors, I am trying to use

return RedirectToAction("PageB", new { id = ID });

But, for some reason, even though I am redirecting to a different action, the anchor is being attached. So, on error it would be going to www.domain.com/Controller/PageA#errors, it goes to www.domain.com/Controller/PageB?id=5#errors. This causes an issue because there is an anchor errors on PageB also. How can I remove the anchor on the redirect?

1

There are 1 best solutions below

0
On

You can remove it manually, by using Url.RouteUrl (which will create a string with your exact URL).