Appending Url Fragments to MVC Routes?
I want to set up a route in my ASP.NET MVC 3 web application, that has a url fragment appended to it, in the same way as some url's on StackOverflow, e.g:
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732382#1732382
However, I can't see any (clean) way of achieving this at the moment.
Is there an 'out of the box' solution or do I need to build a helper of some descriptio开发者_JAVA技巧n to append a url fragment to the end of a normal route?
You could use helpers. For example:
@Html.ActionLink(
"linkText",
"action",
"controller",
null,
null,
"fragment",
new { id = "123" },
new { @class = "test" }
)
or if you want only an url you could use the GenerateUrl method.
精彩评论