What is MVC (Model view controller)?; What are task of each MVC components?; What is namespace for MVC framework?; Can you explain the complete flow of MVC?; Explain Page Life Cycle of ASP.NET MVC?; Can we integrate MVC with ASP.NET?; What are features of

Model-View-Controller (MVC) framework provides an alternative to the ASP.NET framework, which separates an application into three main components: the model, the view, and the controller (as shown).

Model- Model objects retrieve and store model state in a database, implement the business logic for the applications.View-Used to create user interface (UI) from model data.Controller-handle user interaction, work with the model, and ultimately select a view to render

Yes, The ASP.NETMVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication.

Separation of application tasks -Easy to Manage - Manage complexity by dividing an application into the model, the view, and the controller

Full control over the behavior of an application - as it doesn't use view state or server-based forms which will give full control to developer.

Better support for test-driven development (TDD)- Easy to Test

Best suited for large team

An extensible and pluggable framework- You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NETMVC framework also supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models. DI allows you to inject objects into a class, instead of relying on the class to create the object itself. IOC specifies that if an object requires another object, the first objects should get the second object from an outside source such as a configuration file.

Separation of application tasks -Easy to Manage - Manage complexity by dividing an application into the model, the view, and the controller

Full control over the behavior of an application - as it doesn't use view state or server-based forms which will give full control to developer.

Better support for test-driven development (TDD)- Easy to Test

Best suited for large team

An extensible and pluggable framework- You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NETMVC framework also supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models. DI allows you to inject objects into a class, instead of relying on the class to create the object itself. IOC specifies that if an object requires another object, the first objects should get the second object from an outside source such as a configuration file.

Introduction

In this article we are going to see how can we can we track active users in ASP.NET (Web Form & MVC) web application, and to answer questions like How to get online users count? Track/get active user information? etc.

We are going to do it in four steps:

Creating Session Repository

Setting web.config Configuration

Storing Session Data

Removing Session Data

Show Online User (Active Sessions) Count

Background

Please download sample code so that you can follow code along with documentation. Sample code is created using ASP.NET (MVC) framework using Visual studio 2013.

Closing the browser window, or browsing to another site will NOT cause Session_End to fire, at least, not straightaway - the server has absolutely no way of knowing what happens on the client machine until it gets another HttpRequest from it. In this instance, Session_End will fire when the session times out naturally. Default Session time out is 20 minutes.

Show Online Users (Active Sessions) Count In ASP.NET (Web Form and MVC)

Now that we have session information stored in ActiveSessions object, we can show online users count as follows-

Code For MVC 4

<%=NamespaceOfActiveSessionClassFile.ActiveSessions.Count %>

Code For MVC 5

@NamespaceOfActiveSessionClassFile.ActiveSessions.Count

Please like this article on social site if this worked for you… Coding is fun !!! Isn't it...

Separation of application tasks -Easy to Manage - Manage complexity by dividing an application into the model, the view, and the controller

Full control over the behavior of an application - as it doesn't use view state or server-based forms which will give full control to developer.

Better support for test-driven development (TDD)- Easy to Test

Best suited for large team

An extensible and pluggable framework- You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NETMVC framework also supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models. DI allows you to inject objects into a class, instead of relying on the class to create the object itself. IOC specifies that if an object requires another object, the first objects should get the second object from an outside source such as a configuration file.

Introduction

Most of the real work application requires to show data from multiple/different Models / Tables / Databases. Showing multiple models in a view is common requirement, that's where I started Learning different ways to achieve this.

Best approaches of passing / using multiple models (objects) in one view in ASP.NETMVC 4 / MVC 5 are as follows:

As a dynamic type (using @model dynamic)

Using the ViewBag

In ASP.NET MVC - these are almost same but purpose is different.
TempData[] can persist for two request whereas ViewData[] only for one request.

Normaly TempData[] is used when we are passing some info from one request to other. like in case of exception we wanted to get exception instance on error page. so in this case we can keep exception instance in TempData[].

Exception handling is crucial part of every application. It is required for logging errors into database or text/log file, very importantly presenting them to the user in a nicely in case of exception.

Introduction:

When I was working on application I encounter exceptions (e.g. 400, 500, etc ) but I was not sure of what might have caused it. That's where I started exploring various approaches of exception handling in ASP.NET MVC.

There are various ways to handle exceptions, based upon usability and error location/type (SQL, Application, etc)

We are going to see all of them -I will keep on adding stuff to this article :)

It seems then, that this is a good exercise in understanding a number of things:

Thank You...Please like this article on social site if this worked for you… Coding is fun !!! Isn't it...

Introduction

In real-time scenarios we always want to accomplish something differently, effectively and efficiently. Using multiple models in single view is common requirement in most of application. I always prefer to use asynchronous methods for better performance.

Background

Here we are going to accomplish UI as shown below, consist of two modes rendered.

Authorize − This action filter enables you to restrict access to a particular user or role.

[Authorize]

Authorization Filters − Authorization filters are used to implement authentication and authorization for controller actions.

[Authorize]

Result Filters − Result filters contain logic that is executed before and after a view result is executed. For example, you might want to modify a view result right before the view is rendered to the browser.

Exception Filters − Exception filters are the last type of filter to run. You can use an exception filter to handle errors raised by either your controller actions or controller action results. You also can use exception filters to log errors.