0

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 description to append a url fragment to the end of a normal route?

marcusstarnes
  • 6,279
  • 12
  • 62
  • 108

1 Answers1

2

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.

Darin Dimitrov
  • 994,864
  • 265
  • 3,241
  • 2,902