Tag: ASP.NET

IController in ASP.NET MVC

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. The IController interface contains the method Execute which is called when the user enter the URL which involves the implemented controller class. The controller classes that you create can implement IController but you…

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. Well , the process of adding the ASP.NET Web API to the existing ASP.NET Web Forms project is still the same. You can easily do that by installing it from NuGet. Open the Package Console Manager in Visual Studio 2015 and run the following command….

Could not load file or assembly … An attempt was made to load a program with an incorrect format (System.BadImageFormatException)

There are times when you might get the following error when running the application from Visual Studio or opening your application page in the browser. Could not load file or assembly … An attempt was made to load a program with an incorrect format (System.BadImageFormatException) I received this error recently when trying to deploy the application in the IIS and accessing the page from the…

Browser Plugins (Adobe Flash) Detection Toolkits

This article will cover some of the browser detection plugins. There are scenarios where the web developer might want to find out if the Plugin is installed in the browser. The Web developers can use browser plugin detection toolkits/plugins to do it. Browser Plugins (Adobe Flash) Detection Toolkits Jqplugin This plugin extends the jQuery browser object and detect plugins in the browser. Some of the…

15 Best ASP.NET based Content Management Systems(CMS)

ASP.NET is a Web Application development framework thats lets the developers to build dynamic web applications using .NET. In this article , we share 15 cool ASP.NET MVC based CMS (Content Management Systems) that you might find it useful. 15 Best ASP.NET based Content Management Systems(CMS) Orchard Progress Sitefinity Composite C1 Kentico CMS for ASP.NET DotNetNuke: CMS Content Management MojoPortal CMS  Kooboo CMS  Umbraco  Yendo…

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 , you would see that by default the data would be displayed in the XML format as shown in the screenshot. How to return Json instead of XML in ASP.NET Web API ? You can easily change this behavior by adding the following code in the…

How to read a connection string from web.config file in ASP.NET ?

Assume that you have a connectionstring configured in the web.config file of your ASP.NET application and you wish to read it using C# within your application. How to read a connection string from web.config file in ASP.NET ? You can easily do that using the ConfigurationManager class defined in the System.Configuration namespace. 1. Ensure that the System.Configuration assembly is referenced in your project. 2. Add…

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 project instead of creating a new one. How to Add Web API to existing ASP.NET MVC Project ? You can easily do that by installing it from NuGet. Simply open the Package Console Manager and run the following command. Install-Package Microsoft.AspNet.WebApi

ASP.NET MVC and View State

The ASP.NET Web Forms includes the Server Controls which generally retains the state of the controls in the hidden field called _ViewState . Does ASP.NET MVC have View State ? The concept of server controls in ASP.NET Web Forms is different from the ASP.NET MVC . The ASP.NET MVC does not maintain the _ViewState in the HTML pages that is rendered by Razor or ASPX…

Using MapRoute for Registering Routes in ASP.NET MVC 4

The previous article explained How to Create and Register a Route in ASP.NET MVC using the Route class and add it to the RouteCollection. This article will explain how to use MapRoute class for registering routes in ASP.NET MVC 4. Using MapRoute for Registering Routes in ASP.NET MVC 4 The MapRoute is defined in the RouteCollection and can be used without creating the instance of…

IoC Frameworks for ASP.NET Developers

In the previous article , an introduction to the Dependency Injection and IoC frameworks was provided . In this article , let’s see the different IoC Frameworks available for ASP.NET Developers. IoC Frameworks for ASP.NET Developers Below are just links to some of the popular IoC frameworks . Autofac Spring.NET Microsoft Unity Structure Map Castle Windsor Ninject

No parameterless constructor defined for this object error in ASP.NET MVC Project

If you are getting an error similar to the one shown below in your ASP.NET MVC Project , you could verify your Model. No parameterless constructor defined for this object error in ASP.NET MVC Project Server Error in ‘/’ Application. No parameterless constructor defined for this object. An unhandled exception occurred during the execution of the current web request. Please review the stack trace for…

How to display a View from different controller in ASP.NET MVC 4 ?

Sometimes , it might be required to display a view from a different controller when developing website using ASP.NET MVC . How to display a View from different controller in ASP.NET MVC 4 ? This can be achieved by simply passing the view name along with the controller name to the return type of ActionResult like the wasy shown below. In the above example ,…

Files and Folders in ASP.NET MVC 4 Project

Below are some of the files and folders that are created by default when creating a new ASP.NET MVC Project. App_Data – The developers can add the databases like SQLite or SQL Server Express database file or XML files to this folder App_Start – This contains the core settings of the ASP.NET MVC Project. Content – Contains contents like CSS file and images. Controllers –…

How to read connection string from web.config in ASP.NET and C# ?

Here’s a sample code snippet demonstrating how to get the connection string from your ASP.NET web.config file so that you can make a connection to the database. How to read connection string from web.config in ASP.NET and C# ? Assume that the connection string name defined in the web.config file is “conn1” , you would get the connection string using the ConnectionManager class.