Category Archives: ASP.NET MVC

Automapper in ASP.NET Core

AutoMapper is an object-object mapper which allows you to solve the problem of manually mapping each property of a class with the same properties of another class. Read in details. How to use Automapper in ASP.NET Core 1) Add the main AutoMapper Package to your solution via NuGet. PM> Install-Package AutoMapper or   2)  Add… Read More »

How to change the Action name in ASP.Net MVC

ActionName attribute can be used for changing the action name. Below is the sample code snippet to demonstrate more : [ActionName(“TestActionNew”)] public ActionResult Test() { return View(); } So in the above code snippet “Test” is the original action name and in “ActionName” attribute, name – “TestActionNew” is given. So the caller of this action… Read More »

How to Overload the Action Method in ASP.NET MVC

In this article, we will learn how to overload an action method in MVC with example. In Asp.Net MVC, We can overload an Action method via action name attribute . Action methods must be public because private reflection isn’t permitted in medium trust. Action methods cannot be static because all the useful properties that hang… Read More »

Child Action Methods in ASP.Net MVC

In this article, We will learn how to use and where to use Child Action methods. A ChildAction method is an action method which can be accessible from the View only and restricts us to access via an URL. If we try to invoke this action via an URL then it prompts us an error message. We… Read More »

Token Based Authentication using ASP.NET Web API 2, Owin, and Identity

As I stated before we’ll use token based approach to implement authentication between the front-end application and the back-end API, as we all know the common and old way to implement authentication is the cookie-based approach were the cookie is sent with each request from the client to the server, and on the server it is… Read More »

Routing in MVC

Routing is a pattern matching system that handles the incoming request and figure out what to do with that request. At runtime, Routing engine use the Route table for matching the incoming request’s URL pattern against the URL patterns defined in the Route table. In Convention based routing, We need to define routes in the… Read More »

Asp.Net MVC 6 new feature

Cloud-optimized Framework:  Asp.NET MVC 6 (vNext) includes new cloud-optimized versions of MVC, Web API, Web Pages, SignalR, and Entity Framework. .NET vNext support true side-by-side deployment. If your app is using cloud-optimized subset of .NET vNext, you can deploy all of your dependencies including the .NET vNext (cloud optimized) by uploading bin to hosting environment. In… Read More »

How to call controller from React in Asp.Net MVC

Here i will explain how to call controller from “React” in  Asp.Net MVC  with below example: Now Create a ActionMethod that will returns message in the Home Controller ass below code public JsonResult GetMessage() { return Json(new { result = “Hello World From ReactJS Controller” }, JsonRequestBehavior.AllowGet); } Now create jsx file and write code to get the data… Read More »

How to Implement the Repository Pattern in ASP.NET MVC Application

The Repository Pattern is one of the most popular patterns to create an enterprise level application. It restricts us to work directly with the data in the application and creates new layers for database operations, business logic and the application’s UI. If an application does not follow the Repository Pattern, it may have the following… Read More »