ASP.NET MVC Advanced Topics

Slides:



Advertisements
Similar presentations
Implementing Tableau Server in an Enterprise Environment
Advertisements

CHAPTER 15 WEBPAGE OPTIMIZATION. LEARNING OBJECTIVES How to test your web-page performance How browser and server interactions impact performance What.
Turners SharePoint Web Site How we did it. 2 Page Anatomy Custom Search Web Part Custom Search Web Part Data Form Web Parts Content Query Web Part HTML.
Web Page Behavior IS 373—Web Standards Todd Will.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
Microsoft ® Official Course Developing Optimized Internet Sites Microsoft SharePoint 2013 SharePoint Practice.
Internet Information Server (IIS)
.NET Health Monitoring Jonathan Franco ITD Application Services.
Mark Phillip markphillip.com 200s, 304s, Expires Headers, HTTP Compression, And You.
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
IT533 Lectures Configuring, Deploying, Tracing and Error Handling.
Performance, SEO, Accessibility Ivan Zhekov Telerik Corporation
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
IT 210 The Internet & World Wide Web introduction.
Nikolay Kostov Telerik Software Academy Senior Software Developer and Trainer Authentication, Security, Configuration, Performance, Best.
© 2004 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Programming the Web Using ASP.Net Chapter 2: The ASP.Net Template Dave.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
JavaScript & jQuery the missing manual Chapter 11
Real World Examples – Part II 7/26/2013Miro Remias, Sr. Solution Architect.
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
MCSE Guide to Microsoft Exchange Server 2003 Administration Chapter Four Configuring Outlook and Outlook Web Access.
Implementing ISA Server Publishing. Introduction What Are Web Publishing Rules? ISA Server uses Web publishing rules to make Web sites on protected networks.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Introduction to ASP.NET MVC Information for this presentation was taken from Pluralsight Building Applications with ASP.NET MVC 4.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Programming with Visual Web Developer Chapter 9.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
PERFORMANCE ENHANCEMENT IN ASP.NET By Hassan Tariq Session #1.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
Getting started with ASP.NET MVC Dhananjay
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Restricted © Siemens AG All rights reserved A Developer’s Insights Into Performance Optimizations for Mobile Web Apps CT DC AA EM LP2 | June 2015.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
Bundles, Minification Andres Käver, IT Kolledž
Advanced Windows Store App Development with HTML5 Refresh / Exam Prep M6: Tools and Asynchronous Programming Jeremy Foster Microsoft Technical.
IIS Manager Details Delegated Administration Configuration System.
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
05 | Integrating JavaScript and MVC 4 Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek.
Main Concepts of Web Testing Telerik Software Academy Software Quality Assurance.
Building web applications with the Windows Azure Platform Ido Flatow | Senior Architect | Sela | This session.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
Modern Development Technologies in SharePoint SHAREPOINT SATURDAY OMAHA APRIL, 2016.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
BIT 286: Web Applications Lecture 04 : Thursday, January 15, 2015 ASP.Net MVC -
 Cloud Computing technology basics Platform Evolution Advantages  Microsoft Windows Azure technology basics Windows Azure – A Lap around the platform.
//liveVirtualacademy2011/ What’s New for ASP.NET 4.5 and Web Development in Visual Studio 11 Developer Preview Γιώργος Καπνιάς MVP, MCT, MCDP, MCDBA, MCTS,
Building More Powerful ASP.NET Applications with IIS7 Michael Volodarsky COM303 Program Manager Microsoft Corporation.
ASP.NET Overview Brian Hitney Developer Evangelist Microsoft Corporation
Enhance Your Page Load Speed And Improve Traffic.
Site Maps and Navigation
Pre-Production Meet with the client to create a project plan:
Essential tools for implementing and testing websites
Unleash the Power of jQuery
Node.js Express Web Applications
TechEd /1/2018 7:56 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Time is the enemy: Ten Core Lessons for Achieving Peak
Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek
Security mechanisms and vulnerabilities in .NET
Haritha Dasari Josue Balandrano Coronel -
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
ASP.NET Module Subtitle.
ASP.NET 4.0 State Management Improvements – Deep Dive
Created by Atif Aziz. ELMAH means is "Error Logging Modules and Handlers". It is an application-wide error logging facility that is completely pluggable.
Running C# in the browser
Yale Digital Conference 2019
Web Application Development Using PHP
Security - Forms Authentication
Presentation transcript:

ASP.NET MVC Advanced Topics Authentication, Security, Configuration, Performance, Best Practices ASP.NET MVC Telerik Software Academy http://academy.telerik.com

Table of Contents ASP.NET MVC Request Lifecycle Performance Tips Localization and Resources Localizing application – Live demo Diagnostics and Health Monitoring ASP.NET MVC Good Practices

ASP.NET MVC Request Lifecycle

MVC Request Lifecycle

MVC Handler Lifetime – Part 1

MVC Handler Lifetime – Part 2

Action Method Execution

Execute Results

Optimizing ASP.NET MVC applications Performance Tips Optimizing ASP.NET MVC applications

Performance Advices Disable unused view engines Global.asax When accessing data via EF rely on IQueryable Profile your queries Use caching Run in Release mode Avoid passing null ViewModels to Views ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine());

Performance Advices (2) Uninstall URL Rewrite if you don’t use it Html.ActionLink check if the URL is rewritten Use performance profiler (load and performance tests) to measure Use local storage for frequently accessed non sensitive information Use Bundling – concatenating multiple files into a single download Use Minification – making the download file as small as possible

Bundles in ASP.NET MVC Configure bundles Add bundles to the global bundle table Specify a global virtual path Be careful with relative images paths Include the files in the bundle. Use wildcards (*) to avoid issues with file versions Register bundle table during application startup <compilation debug="true" /> BundleTable.EnableOptimization = true;

Performance Advices (3) Use Load balancing Use Asynchronous Controllers to implement actions that depend on external resources Add gzip (HTTP compression) and static cache (images, css, ...) in your Web.config Remove unused HTTP Modules <system.webServer> <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/> </system.webServer>

Client Performance Advices (4) Use CSS sprites Use a Content Delivery Network (CDN) Put stylesheets at the top Make JS and CSS external Put JavaScripts at the bottom Pre-load/Post-load Components Reduce the number of DOM elements Optimize images and CSS sprites Don't Scale Images in HTML (resize) Reduce Cookie Size

Localization and Resources

Localization and Culture Cultures in .NET specify formatting / parsing settings specific to country / region / language Thread.CurrentCulture property Example: DateTime.Now.ToString() Thread.CurrentUICulture impacts resource load Accept-language header <system.web> <globalization culture="auto" uiCulture="auto" /> . . . </system.web>

Resources *.resx files that store localized text Strings.resx stores default resources Strings.bg.resx stores resource for Bulgarian Add the *.resx files to App_GlobalResources or App_LocalResources (depending on their use) Resource manager loads appropriate file Build action – embedded resources Resources could be used in views, models, controllers, data annotations

Localizing ASP.NET MVC Application Live Demo

Diagnostics and Health Monitoring Health Monitoring, Elmah and log4net

Diagnostic and Monitoring When application started and shutdown Unhandled exceptions – stack traces Security related diagnostics Malicious user tries to access unauthorized area When a user logged in Tracing is a great feature for monitoring ASP.NET Web Forms projects (Lifecycles events) Errors can be send on email, log in a file or save in a database

Health Monitoring The built in system in ASP.NET for creating, monitoring and publishing diagnostic info The settings for this monitoring system are set in the machine level web.config file C:\Windows\Microsoft.NET\Framework\{.NET version}\Config\web.config <eventMappings>- Map specific types of errors to an event <rules>Routed events to a provider <providers>Set where to store diagnostic info

Elmah Exceptions logging modules and handlers Install through NuGet – Elmah.MVC It defines some basic settings in web.config Register global filter in the FilterConfig class HandleErrorWithElmahAttribute class

Elmah configuration Configure Elmah in the web.config <security allowRemoteAccess="true" /> <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data/Elmah" /> </elmah> <location path="elmah.axd"> <system.web> <authorization> <allow roles="Administrator" /> <deny users="*" /> </authorization> </system.web> </location> http://code.google.com/p/elmah

ASP.NET MVC Good Practices

Good Practices Use ViewModels and Input Model Validation Add namespaces to Views Use strongly typed views Avoid the ViewBag Use Dependency Container Explore the ASP.NET MVC source code http://aspnetwebstack.codeplex.com/ https://github.com/aspnet/mvc

Isolate your layers properly ViewModel for transmitting data to the view simple POCO de-normalized objects Use AutoMapper for automating projections Use Controllers for selecting the view to be shown and not for business logic Use the view for displaying Html which will be rendered by the browser Not for business logic! Use Services/Repositories for manipulating business objects

Use the PRG (PostRedirectGet) Prevent reposts to the form Issues an HTTP 302 with temporary redirect Use proper verbs [HttpPost], [HttpGet] on you controllers Saving Temporary Data Across Redirects – TempData Dictionary

Productivity Tips Use "NuGet" packages that help with productivity RouteDebugger – debugging routes Glimpse with add-ons – for debugging ELMAH – error logging MvcScafolding Visual Studio Add-ons JustCode (ReSharper) Web Essentials

Other tips You can extend using HttpModules, HttpHandlers HTML5 support Easier deployment + minification (Including cloud deployment) Asynchronous / Await Tooling (Page Inspector, Browser Link, YSlow, Web Developer Toolbar, F12) Web Sockets / SignalR / AJAX

Think about the market! Make you application support globalisation if its going to be on the internet Don’t forget to make accessibility http://plugins.jquery.com/project/KeyTips Mobile phone support improvements Search Engines Optimization (SEO)

ASP.NET MVC Advanced Topics http://academy.telerik.com

Free Trainings @ Telerik Academy “C# Programming @ Telerik Academy csharpfundamentals.telerik.com Telerik Software Academy academy.telerik.com Telerik Academy @ Facebook facebook.com/TelerikAcademy Telerik Software Academy Forums forums.academy.telerik.com