Skip to main content

Posts

Showing posts with the label ASP.NET MVC 6 Example

MVC Anti forgery for HTTP Headers validator

/ / WEB API ANTIFORGERY CUSTOM ACTION FILTER ATTRIBUTE public class AntiForgeryValidateRequests : BaseActionFilterAttribute { public override void OnActionExecuting(HttpActionContext filterContext) { if (filterContext ! = null & & filterContext.RequestContext ! = null & & filterContext.Request ! = null ) { string cookieToken = "" ; string formToken = "" ; IEnumerable < string > tokenHeaders = filterContext.Request.Headers.GetValues( Constant .RequestVerificationToken); if (tokenHeaders ! = null & & tokenHeaders. Count () > 0 ) { string [] tokens = tokenHeaders. First ().Split(':'); if (tokens. Length = = 2 ) { cookieToken = tokens[ 0 ].Trim(); formToken = tokens[ 1 ].Trim(); } } System.Web...

ASP.NET C# 6.0 Features that every ASP.NET Developer should know about it!

  ASP.NET C# 6.0 Features that every ASP.NET Developer should know about it.         1. Auto-property  initializes         public int ID { get ; set ; }         public bool Role { get ; set ; } = true ;         public string Name { get ; set ; } = string .Empty;         public DateTime CreatedDate { get ; set ; } = DateTime .Now;        2. Expression bodied members                     public string Name => string .Format( "{0} {1}" , FirstName, LastName);         3. Getter-only auto-properties                     public DateTime Bi...

13 New Key Features of MVC 6 - [vNext Architecture]

“What”? ‘Why” and “When”? This article introduces to 13 new key Features for MVC 6 and Roslyn Compiler and let’s explore in detail without writing the code. Try the live example of the vNext code shown in this page! Key Features as following as, =>  MVC 6   Added new cloud computing optimization system of MVC , web API, SignalR and entity framework. => The Microsoft  make a bundle of MVC, Web API, WebPages, SignalR , that bundle we called  MVC 6 . => In MVC 6, Microsoft removed the dependency of system.web.dll from MVC 6 because it's so expensive. Typically  it consume 30K memory per request/response. => Right now, in MVC 6 consume 2K  memory per request response. It's too small memory  consume. => Most of the problem solved using the Roslyn Compiler . => Added a Start-up class that replaces to global.asax file. => The Session state and caching adjust our behavior dependin...