No connection string named ‘MyEntities’ could be found in the application config file

I am using entity framework and ASP.NET MVC 4 to build an application My solution is split into two projects; A class library that includes my data model (.edmx) file and a few custom interfaces The ‘container’ MVC project that references the class library above My problem is that when I attempt to use the … Read more

How To Accept a File POST

I’m using asp.net mvc 4 webapi beta to build a rest service. I need to be able to accept POSTed images/files from client applications. Is this possible using the webapi? Below is how action I am currently using. Does anyone know of an example how this should work? [HttpPost] public string ProfileImagePost(HttpPostedFile profileImage) { string[] … Read more

How to pass json POST data to Web API method as an object?

ASP.NET MVC4 Web API application defines post method to save customer. Customer is passed in json format in POST request body. Customer parameter in post method contains null values for properties. How to fix this so that posted data will passed as customer object ? If possible Content-Type: application/x-www-form-urlencoded should used since I dont know … Read more

How to add Web API to an existing ASP.NET MVC 4 Web Application project?

I wish to add an ASP.NET Web API to an ASP.NET MVC 4 Web Application project, developed in Visual Studio 2012. Which steps must I perform to add a functioning Web API to the project? I’m aware that I need a controller deriving from ApiController, but that’s about all I know. Let me know if … Read more

How to add reference to System.Web.Optimization for MVC-3-converted-to-4 app

I’m trying to use the new bundling feature in a project I recently converted from MVC 3 to MVC 4 beta. It requires a line of code in global.asax, BundleTable.Bundles.RegisterTemplateBundles();, which requires using System.Web.Optimization; at the top. When I do this, I get the red squiggly lines that say, “Are you missing an assembly reference?” … Read more