I'm writing a helper method for ASP.NET MVC and I need to call Url.Content
to get an appropriate URL for the context. However, in order to create a new UrlHelper()
I need to get the current RequestContext
(System.Web.Routing.RequestContext
to be precise) and I'm not sure how to grab it. Anyone know?
If the current IHttpHandler is MvcHandler, you can use
((MvcHandler)HttpContext.Current.Handler).RequestContext
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With