1 / 18

MVC - Lessons Learnt From Being Burnt

SESSION CODE: #WEB306. Malcolm Sheridan (@ malcolmsheridan - malcolm.sheridan@gmail ) Quantitative Project Leader ANZ. MVC - Lessons Learnt From Being Burnt. The opinions and viewpoints expressed in this presentation are the presenters own and are not necessarily those of ANZ,

brandice
Download Presentation

MVC - Lessons Learnt From Being Burnt

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SESSION CODE: #WEB306 Malcolm Sheridan (@malcolmsheridan - malcolm.sheridan@gmail) Quantitative Project Leader ANZ MVC - Lessons Learnt From Being Burnt (c) 2011 Microsoft. All rights reserved.

  2. The opinions and viewpoints expressed in this presentation are the presenters own and are not necessarily those of ANZ, its partners or employees. (c) 2011 Microsoft. All rights reserved.

  3. Prize giveaway! 1 Telerik Ultimate Collection work $1999 USD (c) 2011 Microsoft. All rights reserved.

  4. Where has this talk come from? • Intranet ANZ website built with ASP.NET MVC 3 • 45,000+ users’ globally • Multiple web servers • Not all about lessons learnt, but tips too (c) 2011 Microsoft. All rights reserved.

  5. What will you learn today? • Handling exceptions • Ajax exceptions • ActionFilterAttribute order • Multiple form submissions • Routing constraints • ControllerActionInvoker • Security (c) 2011 Microsoft. All rights reserved.

  6. Handling Errors Error handling is absolutely required. In MVC you do things a little differently… • You still use customErrors in web.config • Alternatively you can handle exceptions at the action and controller level through ActionFilters • Or use global ActionFilters (c) 2011 Microsoft. All rights reserved.

  7. Handling Ajax Errors No more UpdatePanel as you may be used to in Web Forms! • Errors thrown on Ajax calls need to be handled with care, otherwise you’ll never hear them! (c) 2011 Microsoft. All rights reserved.

  8. Implementing Security MVC works slightly different Web Forms • You can still use the built in .NET Role and Membership providers. • Secure actions and controllers • Custom ActionFilters (c) 2011 Microsoft. All rights reserved.

  9. ActionFilter ordering ActionFilters are great, but it’s important to understand how they run. • They have a undetermined order starting at -1 • Security filters always run first! (c) 2011 Microsoft. All rights reserved.

  10. Handling multiple form posts Strictly ASP.NET MVC. • One form can have multiple submit buttons, so what’s the cleanest way to handle this scenario? • ActionMethodSelectorAttribute is your friend (c) 2011 Microsoft. All rights reserved.

  11. Routing constraints Routes are one of MVC’s biggest features • Understanding how to use them can turn your URL’s into a work of art • This tip show you how to change routes depending on the HTTP verb (c) 2011 Microsoft. All rights reserved.

  12. So what have you learned? • Error handling as well as handling Ajax errors • Implement security • ActionFilterAttribute ordering • ControllerActionInvoker to centralize handling requests • Routing constraints (c) 2011 Microsoft. All rights reserved.

  13. That’s it. Thanks for attending the session!malcolm.sheridan@gmail.com@malcolmsheridan (c) 2011 Microsoft. All rights reserved.

  14. Prize giveaway! 1 Telerik Ultimate Collection work $1999 USD (c) 2011 Microsoft. All rights reserved.

  15. Enrol in Microsoft Virtual Academy Today Why Enroll, other than it being free? The MVA helps improve your IT skill set and advance your career with a free, easy to access training portal that allows you to learn at your own pace, focusing on Microsoft technologies. • What Do I get for enrolment? • Free training to make you become the Cloud-Hero in my Organization • Help mastering your Training Path and get the recognition • Connect with other IT Pros and discuss The Cloud Where do I Enrol? www.microsoftvirtualacademy.com Then tell us what you think. TellTheDean@microsoft.com

  16. Resources • www.msteched.com/Australia • Sessions On-Demand & Community • www.microsoft.com/australia/learning • Microsoft Certification & Training Resources • http:// technet.microsoft.com/en-au • Resources for IT Professionals • http://msdn.microsoft.com/en-au • Resources for Developers (c) 2011 Microsoft. All rights reserved.

  17. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. (c) 2011 Microsoft. All rights reserved.

More Related