0

in my MVC3 app i have all my Controllers inherit from a custom BaseController (which in turn inherits from Controller). Is there any any way to fetch the RouteData.Values from the requested url here?

stefjnl
  • 732
  • 3
  • 14
  • 31

1 Answers1

0

Well, RouteData.Values should be directly available from any controller action - so you can just address it from your controllers. Do you have any specific piece of code that has problems with that?

Sergey Kudriavtsev
  • 10,328
  • 4
  • 43
  • 68
  • 1
    yes it was available from the Controllers inself but not in my custom BaseController. i managed to fetch with the HttpContext solution that Hugoware provides here: http://stackoverflow.com/questions/223317/httpcontext-on-instances-of-controllers-are-null-in-asp-net-mvc – stefjnl Feb 10 '12 at 13:56
  • I've checked this in my own project which also has Controllers inherited from custom BaseController - so exactly the same situation - and it worked for me. What specific error do you get and in what part of code? Well, if you've found a solution then nevermind. – Sergey Kudriavtsev Feb 10 '12 at 13:59
  • Sergey, thanks for your reply. yes ive found a solution but to sketch the problem: in my custom BaseController, RouteData.Values["country"] was always null. i had to use Hugoware solution to be able to access the values from RouteData in my BaseController. – stefjnl Feb 10 '12 at 14:48