Using Request inside Actions: why it is a bad idea

Posted by: Code Climber, on 05 Jun 2009 | View original | Bookmarked: 0 time(s)

Why cant I use Request["id"] inside an action to get the value of the query string parameter named "id"? I was asked this questions millions of times in the talks I did about ASP.NET MVC during the last months. I also got it asked a few times from colleagues so, when yesterday a friend asked the same question on a comment on one of my latest posts, I decided that the time had come to try and clarify this with a post. The quick answer is: Because you dont want to have a dependency on the environment,...

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 559 | Hits: 51

Similar Posts

  • Session State Not Working? Check Your Web Garden! more
  • How to download Internet Explorer 8 for Windows 7 E without any Web browser? more
  • 6 Tips for ASP.NET MVC Model Binding more
  • Handling security for Flex and Silverlight in ASP.NET more
  • Twitter API - Submit a post in C# more
  • Calling the Twitter API in C# more
  • Brokered authentication for REST active clients with SAML more
  • XM Radio Player Part II : Scraping more
  • Use UTF-8 Encoding in HTTP Requests more
  • Integrating MVC with Silverlight more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD