The located assembly’s manifest definition does not match the assembly reference

Looking for the solution. Yes you are at the right place. Once I also faced the same issue when I was working on a MVC project, I got the error states that “The located assembly’s manifest definition does not match the assembly reference” .


When I ran the solution I saw the YSD (yellow screen of death) that simply gave me the assembly name which is causing the issue.

Could not load file or assembly ‘System.Web.Optimization, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. HRESULT: 0x80131040

In my case I have several MVC projects referring to “System.Web.Optimization” , but I’m getting this issue only in newly added project. When I investigated the issue I found that the project referring to the higher version of “System.Web.Optimization”. This is because the dll has been included using nuget and nuget always downloads the latest version of dll.

FYI:  The Microsoft.Web.Optimization package is now obsolete. With ASP.NET (MVC) 4 and higher you should install the Microsoft ASP.NET Web Optimization Framework.

Continue reading “The located assembly’s manifest definition does not match the assembly reference”

MVC HTML Helpers Methods

In this article we will learn what are HTML helper Methods that comes within MVC framework!!!!…

So What are HTML Helper Methods ???

Html Helpers methods are equivalent to ASP.Net web form controls, enables you to render HTML content, modify the HTML output .

  • HTML Helpers are more light  weight.
  • It does not have event model and viewstate.

HTML Links

The easiest way to render HTML link is to use HTML.ActionLink() helper . With MVC , the HTML.ActionLink() does not link to view rather it creates a link to controller.



HTML Helpers

Continue reading “MVC HTML Helpers Methods”

Data Entry Form using Simple HTML Helper In MVC

HTML Helper in MVC

In this article we will learn how to code for entering data form using simple HTML Helpers.

  • Create New ASP.NET MVC4 Web Application.
  • Select Razor As View Engine.
  • Right click on Model ->Add new Class ->Customer Class.HELPersModel
  • Right click on controller and -> Add new item-> CustomerController


Continue reading “Data Entry Form using Simple HTML Helper In MVC”

Render Pdf bytes array within browser in MVC

Render Pdf within browser

There are different ways to render Pdf in a browser. In this I’m explaining to render Pdf by fileContent/byte array. In a below example I’m using Index Action which returns the FileContentResult.

public ActionResult Index()
Response.AddHeader(“Content-Disposition”,“inline; filename=sample.pdf”);
Response.AddHeader(“Content-Length”, byteArray.Length.ToString());
FileContentResult result = new FileContentResult(byteArray, “application/pdf”);
return result;

That’s it from controller side. Now you have to call you Action to get it rendered on your HTML. You can use different HTML5 tags like :

<iframe src = @Url.Action(“Index”, “Home”)#zoom=150′ width = “100%” height=”525″ id=”iFramePdf” #zoom=”200″ frameBorder=”1″></iframe>

<embed src=’@Url.Action(“Index”, “Home”)#zoom=150′ width = “100%” height=”525″ id=”iFramePdf” #zoom=”200″ frameBorder=”1″ type=”application/pdf”/>

<object data=’@Url.Action(“Index”, “Home”)#zoom=150′ width = “100%” height=”525″ id=”iFramePdf” #zoom=”200″ frameBorder=”1″ type=”application/pdf”>

Hope this article will help you.

MVC Simple Model In ASP.NET

In our previous article we have learnt basics of MVC , now in this article we will learn how to make simple model In MVC.

  • Create New ASP.NET MVC 4 Web Application .
  • Select Internet Website as template.
  • Select ASP.NET as  View Engine
  • Right Click on the model -> Add New Item ->Class -> Movies.cs

Continue reading “MVC Simple Model In ASP.NET”

Avoid multiple call to AuthorizeCore in MVC

AuthorizeCore in MVC

In MVC AuthorizeAttribute Class is another cool feature that makes it easy to add authentication at the Controller level. In AuthorizeAttribute class we have AuthorizeCore function, it specifies that access to a controller or action method is restricted to users who meet the authorization requirement. We can override AuthorizeCore  function as per our authorization logic.

When you place the [Authorize] attribute on a Controller’s action method, a couple of calls get made to the AuthorizeAttribute class at the beginning of each request to your controller to authenticate users. Lately when I was working on a web application I found this multiple calls as an extra overload that even though the user is authorized, AuthorizeCore got executed.

So to avoid this multiple calls, I found one of the property in HttpContext which is  SkipAuthorizationSkipAuthorization is a boolean property, you can set this as true once the user is authorized. The below code snippet will give you the brief idea.

protected override bool AuthorizeCore(HttpContextBase httpContext)
if (httpContext.SkipAuthorization) return true; // hack to avoid multiple call to the method
if (!authorized) //if user is not authorize
   return false;
if (authorized) //if user is authorize
   httpContext.SkipAuthorization = true;
   return true;
   return false;

Autocomplete Textbox Using Jquery/JSON from Database

JSONIn web page designing  autocomplete property of textbox is widely used for making the site user friendly and interactive , so in this article we will understand the simple method for autocompletion of textbox using Jquery.

First we will see a simple example for this then in next step I will show you how you can fetch the data from the database using JSON



<!-- Load jQuery, jQuery UI and jQuery ui styles from jQuery website -->
<<link rel="stylesheet" href="" />
<script src=""></script>
<script src=""></script>

var data = [
function () {
source: data,
 autoFocus: true,


<label for="City">City <input type="text" name="CityNames" id="City" /></label>


Continue reading “Autocomplete Textbox Using Jquery/JSON from Database”

Export to excel table without hitting server using Jquery

Want to export the data to excel, but don’t  want to hit server again and again ?? So here is the simple way out for you.

In the following steps you will understand how simply we can export the data to excel sheet by using jquery.

Continue reading “Export to excel table without hitting server using Jquery”

MVC Basics for Beginners

MVC Basics

In this article you will learn some basic concepts of  MVC Architecture.

So what is MVC ?

  • An Architectural design principle that separates the components of a Web Application.
  • This separation gives you more control over the individual parts of the application , which lets you more easily develop , modify and test them.
  • Three main components : The Model, The View, The Controller.
Models, Views, and Controllers
  • ModelModel holds application data , data access logic.
  • ViewMarkup and content that is returned to the browser
  • ControllerFires off some logic in response to a web browser request it listens incoming request from the browser manipulate the model data prepare the view to display in response to the web browser. 


Continue reading “MVC Basics for Beginners”