Advance Concept of MVC 5

What is MVC?

MVC is an architectural pattern that consists of three parts: Model, View, and Controller. Each of these components is designed to handle different parts of application development.

  • Model: The model is responsible for handling data and business logic.
  • View: The user interface is handled by a view (user interface).
  • Controller: A controller can have both action and non-action methods and is used to handle browser user requests.

Advance Feature of MVC

There are several new advanced features in ASP.Net MVC 5. Below are a few exciting features In this article, we’ll talk about them.

  • Filter Overrides
  • Identity
  • Attribute-based routing
  • Authentication Filters
  • One
  • Default MVC Template replaced by Bootstrap
  • Generating code using Scaffolding
  • ASP.NET Membership System
  • Razor SDK

About Filter Overrides in Asp.Net MVC application

ASP.NET MVC 5 has a new feature Filter Override that allows us to clear or hide specific Filters that were defined in a higher scope.

For example, If we build a global action filter, it applies to all controllers, if we apply the filter at the controller level, it applies to all of that controller’s actions, However, we could overrule such filters at the controller action level on a case-by-case basis. This enables us to define global or controller filters that apply in practically all circumstances and then override them in a few particular areas when they don’t need them.

Hire .NET Developers

As far as we know MVC supports the following five types of filters:

  • Authentication filters
  • Authorization filters
  • Action filters
  • Result filters
  • Exception filters

As a result, five filter overrides correspond to this :

  • OverrideAuthenticationAttribute
  • OverrideAuthorizationAttribute
  • OverrideActionFiltersAttribute
  • OverrideResultAttribute
  • OverrideExceptionAttribute

Create a new Asp.Net MVC Application

In this window, we’ll select the MVC project template and then click Next.

image 1 image 1

After clicking on create it will show one dialog box in that first choose Authentication type on just click on Change Authentication button and a new popup box will open with the name “Change Authentication”. Individual User Accounts will be selected here.


After creating a project, go to add Filter folder in the project, as shown in the above image.


After creating a folder, create a class inside it and extended FilterAttribute and IAuthenticationFilter



After creating a custom authentication filter, we are going to add it in Homecontroller that is already created while creating the project.


Now just save and run the project on https://localhost:****/Home/Index.

Because of the authentication attribute being applied at the controller level, it will redirect to Error View as seen below.


Like when clicking on another tab like About or concat getting the same error page.

( URL: – http://localhost:****/Home/Contact)

( URL: – http://localhost:****/Home/About)

Now just Apply OverrideAuthentication Filter on Action Method where you want to access it without authentication.


After applying it, save and run the project again and redirect to this URL : http://localhost:****/Home/Contact. It will access without authentication.



Filter Overrides in ASP.NET MVC 5 come in handy when you’re adding global or controller filters in your ASP.NET MVC Websites and just need to override them in a few places.

Later on, We’ll talk about some of Asp.Net MVC 5’s advanced features.

You may learn more about filter override and functionality by visiting the below URL.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply