I want to access a request parameter in (Razor) View. For example, bgColor sets the background color of the page. In View, I need to set Request["bgColor"] ?? "red". In contrast with RubyOnRails, where (in addition to the Request object) we have params hash with each request and that param hash is accessible in controllers as well as the rendered views for that request (params[:bgColor]), what would be the best 'n sleek way to access a request parameter in Razor-View:
- Request["paramName"]?
- Pushing it to ViewBag.bgColor in controller?
- Is there any parameter object/hash (like happen in RoR) which contains all the request params, whether they are captured in action's parameter list or not?