RedirectToAction or View as ActionResult in ASP .Net MVC5 ?

We have often seen action returns a View method. Optionally we can also pass the view name and the other parameters in the View method. Most of the time we return a view as ActionResult to navigate. Now I have a requirement to navigate to Login view or return Login view on the basis ofContinueContinue reading “RedirectToAction or View as ActionResult in ASP .Net MVC5 ?”

Attribute Routing in ASP.NET MVC 5

ASP.NET MVC 5 introduced Attribute Routing. It allows you to apply a route directly on the controller class. Before we use the Attribute Routing, let’s relook how the convention based routing works. We create a route as follows: Index action of Home controller can be accessed on two different URLs. Either using the base URLContinueContinue reading “Attribute Routing in ASP.NET MVC 5”

Work with ASP.NET MVC 5 Areas from different projects

Read full article on Falafel blog While working on an ASP.NET MVC 5 application, I came across a requirement to use an Area from one project in another project. For example: I have a project A and a project B. I need to use an Area which is part of project B inside of projectContinueContinue reading “Work with ASP.NET MVC 5 Areas from different projects”

User Instance login flag is not allowed when connecting to a SQL Server instance: Solved

While working with an ASP.NET MVC application I encountered following exceptions: Exception clearly says that user instance login flag is not allowed when connecting to a SQL Server instance. For sure this error is related to SQL Server instance I am working on in this particular application. I examined the connection string in the web.configContinueContinue reading “User Instance login flag is not allowed when connecting to a SQL Server instance: Solved”

Refactoring the ASP.NET MVC Application to the Onion Architecture

We have refactored the application adhering to the onion architecture. Domain objects like Movie is at the center of the architecture and are the part of internal layers. The Infrastructure project in which we are working with database and database logics are part of the external layers. They depend on the centeral layers like core. UI or in this case the MVC application is also an external layer and depndes on the Core project. All layers are interacting to each other using the interfaces rather than the concrete definitions. You can very easily write Unit Test against the controllers using Fake or Mock without hitting the datbase. In future you can easily change data access technology from Enity Framework to something else without affecting the UI and the Core.

No connection string named ” could be found in the ASP.NET MVC application config file: Solved

While working on an ASP.NET MVC application I encountered the following error. It clearly says that some connection string is missing in the configuration file. Well I have refactored the application following the onion architecture and there is nothing related to database exist in the MVC project. Project structure looks like follows: The Entity FrameworkContinueContinue reading “No connection string named ” could be found in the ASP.NET MVC application config file: Solved”

Day #2: Learn ASP.NET MVC 5- Adding View

Day #1: Learn ASP.NET MVC 5- Adding Controller On Day1 we learnt about Adding Controller. Today we will learn to add View in MVC project. Let us start with understanding with is View? View is part of MVC that renders user interface. View contains markup that gets render with ViewEngines. ViewEngines generates View in ASP.NETContinueContinue reading “Day #2: Learn ASP.NET MVC 5- Adding View”