Implementation of Google OAuth in MVC application: Step 1: Create a Google OAuth application To create it please follow the steps below: Go to https://console.developers.google.com, login with your Gmail id. Click on ‘Select a Project’ dropdown at left top of the page. Click on ‘Create project’ button, Enter project name and create project. Click Credentials on the left navigation. Click Create Credentials > O...
Read More
Securing ASP.NET Web API using Custom Token Based AuthenticationProviding a security to the Web API’s is important so that we can restrict the users to access to it. We can provide the security in two different ways: Basic authentication. Token based authentication.In this blog, we will discuss how we can implement token based authentication. Below diagram shows the control flow of token based authentication.Fig: Token based authentication for Web API’s.How token based authentication...
Read More
What does it mean?Asynchronous actions allow developers to handle more concurrent requests and can be implemented using async / await keywords.Asynchronous actions are useful in scenarios where we are performing some network operation such as calling a remote service, webapi etc.What are the Benefits?1) It can make application to handle more users. 2) It can process multiple I/O bound methods in parallel3) It can make UI interface more responsive to the user4) It can perform compl...
Read More
View Engine is responsible for rendering the view into html form to the browser.ASP.NET MVC includes two different view engines, the newer Razor View Engine and the older Web Forms View Engine. What is Razor?The Razor view was introduced with ASP.NET MVC 3 and is the default view engine moving forward.Razor provides a streamlined syntax for expressing views that minimizes the amount of syntax and extra characters. It effectively gets out of your way and puts as little syntax as possible between ...
Read More
ASP.NET MVC provides us two options ViewData and ViewBag for passing data from controller to view.ViewData and ViewBag are almost similar. Passing data with ViewBag.The ViewBag feature allows us to define arbitrary properties on a dynamic object and access them in a view.The dynamic object is accessed through the Controller.ViewBag property.Let us see how the ViewBag works through a small example.After creating a new MVC application in the HomeController Write the following code in the Inde...
Read More
There are multiple Validation attributes available in MVC. Validation attributes comes from System.ComponentModel.DataAnnotations.Available validation attributes are-System.ComponentModel.DataAnnotations.CompareAttributeSystem.ComponentModel.DataAnnotations.CustomValidationAttributeSystem.ComponentModel.DataAnnotations.DatatypeAttributeSystem.ComponentModel.DataAnnotations.MaxLengthAttribueSystem.ComponentModel.DataAnnotations.MinLengthAttributeSystem.ComponentModel.DataAnnotations.RangeAttribut...
Read More
Introduction: ASP.NET MVC is a framework for building web applications that uses the model-view-controllerpattern. Like ASP.NET Web Forms, ASP.NET MVC is also built on top of the ASP.NET Framework. This means we can usesame APIs like security, state management, membership, caching,ajax etc in MVC Applications. Every ASP.NET MVC application has three parts: a model, views, and controllers. Model:It consists of all the classes that handle data and business logic. Con...
Read More
ASP .Net MVC Error Logging Using Google ElmahIntroduction: ELMAH is one of the popular Library to logging unhandled errors provided by Google .It’s an application wide error logging facility which can be dynamically plugged. You don’t need to recompile the code. It’s pluggable. Below I will show you how to log your errors using elmah without having to write even one line of code. More over when you deploy it on a server you can remotely view the errors.In this blog I am explain...
Read More