0

I'm writing my own helper and it needs to get a path as a parameter. I can of course refer to it directly passing a string or using Url.Action(). But what if I want to generate fully qualified URI inside of my helper method using action, controller and route values?

It does look a little bit messy right now

 @Ajax.MyHelper(Url.Content("~/Admin/Administration/DeleteItem?Id=<#= Id #>"))
iLemming
  • 34,477
  • 60
  • 195
  • 309

1 Answers1

2

Inside the helper, you can call

new UrlHelper(ajax.ViewContext.RequestContext).Content(...)
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964