Exception Filters in C-Sharp 6.0

So far we deal with the Exceptions as below. As you see in the following code snippet, we are catching the exception and displaying the error message. Challenge in the above snippet is that you cannot apply filter to the exception. Of course you can have if-else statement inside the try catch block but itContinueContinue reading “Exception Filters in C-Sharp 6.0”

Child Actions in ASP.NET MVC

Read full post on falafel blog Child Actions are the action methods which can be invoked within the view. This is used to work with the data in the view, which are not related to the main action method. For example, if you want to create a data driven widget in the view using dataContinueContinue reading “Child Actions in ASP.NET MVC”

Prototypical inheritance in JavaScript

Read full post on falafel blog Before we can understand prototypical inheritance, let us start with a problem statement. You have a student for whom you need to: Calculate their grade Print the grade In JavaScript this can be simply implemented as follows: There are some inherent problems in the above approach: Variables are definedContinueContinue reading “Prototypical inheritance in JavaScript”

Check User exists in a Role in ASP.NET Identity 2.0

Read full post on Falafel blog ASP.NET MVC5 uses Identity 2.0 to manage the users and their roles. There may be scenario to check whether the currently logged in user or any user with the id exists in the given role or not, and checking can be done either in the controller class or inContinueContinue reading “Check User exists in a Role in ASP.NET Identity 2.0”

Start-up code using WebActivator in MVC application

Read full post on Falafel blog WebActivator allows us to execute a code long before application start-up. There may be requirements when you need to load external assemblies or instantiate a particular object before the application start up. You need to make sure some codes execute before the codes inside the App_Start folder and theContinueContinue reading “Start-up code using WebActivator in MVC application”

Seed the database with initial Users in MVC 5

  Read full article on Falafel blog In MVC 5 applications you may want to seed the database with initial users for various reasons. You may want default users and roles added as part of the application. In this post, we will take a look at how to  seed the database with default users.The MVCContinueContinue reading “Seed the database with initial Users in MVC 5”

Custom Action Filter in ASP.NET MVC 5

Read full article on Falafel blog here ASP.NET MVC 5 provides five different kinds of Filters. They are as follows: Authentication [Introduced in MVC5] Authorization Action Result Exception Filters are used to inject logic at the different levels of request processing. Let us understand where at the various stages of request processing different filters getContinueContinue reading “Custom Action Filter in ASP.NET MVC 5”

What is Azure DocumentDB

Read full article on Falafel blog here Recently I attended Cloud Camp by Microsoft India in Delhi. I had good time learning at the event. Besides other Microsoft Azure services like Azure Websites, Azure Mobile Services and Azure DocumentDB impressed me lot. In this post, I am sharing first level learning on Azure DocumentDB. AzureContinueContinue reading “What is Azure DocumentDB”