---
title: "The model item passed into the dictionary is of type 'model' exception in ASP.NET MVC."  
description: "The model item passed into the dictionary is of type 'model' exception in ASP.NET MVC."  
author: "Revati S Misra"  
published: 2023-04-14  
updated: 2023-06-04  
canonical: https://www.mindstick.com/forum/157822/the-model-item-passed-into-the-dictionary-is-of-type-model-exception-in-asp-dot-net-mvc  
category: "asp.net mvc"  
tags: ["asp.net", "asp.net mvc"]  
reading_time: 2 minutes  

---

# The model item passed into the dictionary is of type 'model' exception in ASP.NET MVC.

The [model](https://yourviews.mindstick.com/view/81334/america-is-reopening-after-corona-lockdown-but-on-swedish-model) [item](https://www.mindstick.com/forum/156564/remove-item-in-an-array-in-javascript) passed into the [dictionary](https://www.mindstick.com/articles/1500/hashtable-and-dictionary-in-c-sharp) is of type 'MindStick.Web.Models.Register', but this dictionary requires a model item of type 'MindStick.Web.Models.UserLogin'.

## Replies

### Reply by Aryan Kumar

The error message "The model item passed into the dictionary is of type 'model' exception in ASP.NET MVC" occurs when you try to pass a model object to a dictionary that expects a different type of object. For example, the following code will generate this error:

Code snippet

```plaintext
public class ProductsController : Controller
{
    public ActionResult Index()
    {
        var products = new List<Product>();
        // This will generate an error because the dictionary expects a string.
        var dictionary = new Dictionary<string, Product>(products);
        return View(dictionary);
    }
}
```

To fix this error, you need to make sure that the type of the model object that you are passing to the dictionary matches the type of object that the dictionary expects. In this case, you could change the code to the following:

Code snippet

```plaintext
public class ProductsController : Controller
{
    public ActionResult Index()
    {
        var products = new List<Product>();
        // This will not generate an error because the dictionary expects a Product.
        var dictionary = new Dictionary<Product, string>(products);
        return View(dictionary);
    }
}
```

Here are some other possible causes of this error:

- The model object that you are passing to the dictionary is not a valid object. For example, if the model object is null or has no properties, you will get this error.
- The dictionary is not initialized correctly. For example, if you do not specify the type of object that the dictionary expects, you will get this error.

If you are still getting this error after checking these possible causes, you can post a question on Stack Overflow or the ASP.NET MVC forums for help.


---

Original Source: https://www.mindstick.com/forum/157822/the-model-item-passed-into-the-dictionary-is-of-type-model-exception-in-asp-dot-net-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
