0

How to pass #text with URL when redirecting from RedirectToAction after post method

My URL: www.test.com/testController/testAction/15

I want this URL to be

www.test.com/testController/testAction/15#test
  • 2
    Possible duplicate of [Redirect to a hash from the controller using "RedirectToAction"](https://stackoverflow.com/questions/10690466/redirect-to-a-hash-from-the-controller-using-redirecttoaction) –  Jan 08 '18 at 12:01

2 Answers2

0

You can use Redirect for this in MVC

return Redirect("~/testController/testAction?id=15#test");

I hope this will work for you.

Muhammad Asad
  • 1,772
  • 16
  • 23
0

Use this RedirectResult

return new RedirectResult(Url.Action("testAction", "testController", new { id = 15 }) +"#Text");