As already said, with routes it is not possible to do this.
One way to do this would be to alter the return of Controller
for a Redirect()
to the desired page.
Something like that:
return Redirect("/Home/Contact#contato");
Or this:
return Redirect(Url.Action("Contact", "Home") + "#contato");
Remembering that this will only put "an anchor" at the end of the URL. I’m not sure what you want to do with it.
If you want more details, this question has more answers about what you asked.
Note: If you choose to use Redirect()
, take care. If the request for the same Action()
, will cause a Infinite Loop.
In case you want to do this on the client, you can customize the Htmlhelper and create your own, with the desired route.
Do you want to use as a normal character? That is, do you want to escape the character and not be interpreted by the browser? Tried to use %23?
– Maniero
Like a normal character. Like a SPA (angular) route. Example: http://mydomain.com.br/#/Cars? id=10.
– Matheus Bessa
You tried what I said?
– Maniero
Didn’t work out...
– Matheus Bessa