Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a parameter for an anchor/hash to a RedirectToRouteResult?

I want to use a RedirectToRouteResult to redirect to a url like /users/4#Summary. Using ASP.NET MVC 1.0, I haven't been able to find a way to do that - have I missed it?

like image 781
Peter Mounce Avatar asked Nov 25 '09 10:11

Peter Mounce


People also ask

How to use anchor Tag in ASP net?

The Anchor Tag Helper enhances the standard HTML anchor ( <a ... > </a> ) tag by adding new attributes. By convention, the attribute names are prefixed with asp- . The rendered anchor element's href attribute value is determined by the values of the asp- attributes.

Which is the correct way to specify an anchor hyperlink in MVC view?

The Anchor Tag Helper generates HTML anchor (<a> </a>) element by adding a new attribute. The "href" attribute of the anchor tag is created by using new attributes. The Anchor Tag Helper generates an HTML anchor (<a> </a>) element by adding new attribute.


1 Answers

You should properly build your routes in route table. Eg.:

routes.MapRoute("MyRoute" ,"{controler}/{id}#{detail}" ,new { controller = "users", action = "index", id = (string)null, detail = "Summary" });
like image 151
dariol Avatar answered Sep 30 '22 13:09

dariol