IController in ASP.NET MVC

Published on April 29, 2013 by abundantcode

Filed under ASP.NET

Last modified April 29, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 3602 times

Every Controller in ASP.NET MVC is extended from the Controller abstract class which in turn implements the IController interface. The IController interface is defined in the System.Web.Mvc namespace of the .NET Framework.

IController in ASP.NET MVC

The IController interface contains the method Execute which is called when the user enter the URL which involves the implemented controller class.

#region Assembly System.Web.Mvc.dll, v4.0.0.0

// C:\temp\MvcApplication1\packages\Microsoft.AspNet.Mvc.4.0.20710.0\lib\net40\System.Web.Mvc.dll


using System;

using System.Web.Routing;

namespace System.Web.Mvc


// Summary:

// Defines the methods that are required for a controller.

public interface IController


// Summary:

// Executes the specified request context.


// Parameters:

// requestContext:

// The request context.

void Execute(RequestContext requestContext);



The controller classes that you create can implement IController but you might have to do little more work when using this way. For example, you might have to implement the method Execute and write the code on what actions to be taken on request.

There is a better way of doing it using the Controller class which will be discussed in the next article.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


You might be Interested in these Posts

How to return Json instead of XML in ASP.NET Web API ?

When you make a call to the ASP.NET Web API action method and notice this in Google Chrome browser ,...

How to Add Web API to existing ASP.NET Web Forms Project ?

In one of the previous posts , we saw how to add the WebAPI to the existing ASP.NET MVC project. Wel...

How to Add Web API to existing ASP.NET MVC Project ?

There are times when you might want to add Web API project to one of your existing ASP.NET MVC proje...