Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 52307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:53:11+00:00 2026-05-10T16:53:11+00:00

I am developing an application using MVC Preview 5. I have used typed views.

  • 0

I am developing an application using MVC Preview 5. I have used typed views.

After setting debug=’false’, I have found that I am receiving errors of the form:

‘The model item passed into the dictionary is of type ‘blah.Models.UserAdmin.IndexData’ but this dictionary requires a model item of type ‘blah.Models.OrganisationAdmin.IndexData”.

I do not get these errors when debug is on.

It looks like that the MVC framework is caching views by view name. If I have two actions that use views with the same name (albeit in different namespaces), I find that only the action that is executed first is successful, the second always results in this error.

For example, I have a UserAdminController and an OrganisationAdminController.

  • Both have an ‘Index’ action.

  • Both use a view called ‘Index.aspx’ (each contained in the controller’s view folder; Views/UserAdmin/Index.aspx and Views/OrganisationAdmin.Index.aspx).

  • Both views are typed and make use of models called IndexData (blah.Models.UserAdmin.IndexData and blah.Models.OrganisationAdmin.IndexData)

If I visit OrganisationAdmin/Index first, I find that any subsequent attempt to view UserAdmin/Index results in the error message shown above.

Conversely, if I visit UserAdmin/Index first (after restarting the application), I find that navigating to OrganisationAdmin/Index causes an equivalent error (with the types the other way around).

I renamed one of my views “UserAdminIndex.aspx” and this seemed to fix the problem. However, this doesn’t feel like it should be an issue. Surely the MVC framework support similarly named views? I am missing something?

Any help gratefully received.

Sandy

Please note, I have seen the question ‘In ASP.NET MVC I encounter an incorrect type error when rendering a user control with the correct typed object’. I am facing a similar problem, but I am not using RenderUserControl().

The stack trace:

InvalidOperationException: The model item passed into the dictionary is of type 'blah.Models.RoleAdmin.IndexData' but this dictionary requires a model item of type 'blah.Models.UserAdmin.IndexData'.]    System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value) +231    System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary viewDataDictionary) +99    System.Web.Mvc.ViewPage`1.SetViewData(ViewDataDictionary viewData) +60    System.Web.Mvc.WebFormView.RenderViewPage(ViewContext context, ViewPage page) +64    System.Web.Mvc.WebFormView.Render(ViewContext viewContext, TextWriter writer) +85    System.Web.Mvc.ViewResult.ExecuteResult(ControllerContext context) +206    System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ActionResult actionResult) +19    System.Web.Mvc.<>c__DisplayClass12.<InvokeActionResultWithFilters>b__f() +18    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +257    System.Web.Mvc.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() +20    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +257    System.Web.Mvc.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() +20    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ActionResult actionResult, IList`1 filters) +188    System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +386    System.Web.Mvc.Controller.ExecuteCore() +112    System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +23    System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7    System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +107    System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +39    System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:53:12+00:00Added an answer on May 10, 2026 at 4:53 pm

    Yes, the bug has been reported. Best leave debug on for now, or modify the offending code (sorry cant recall where).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 120k
  • Answers 120k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Most likely because CreateCriteria() creates a new criteria (instead of… May 12, 2026 at 12:02 am
  • Editorial Team
    Editorial Team added an answer did you check http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/errors.htm ? there is a list of… May 12, 2026 at 12:02 am
  • Editorial Team
    Editorial Team added an answer Have you also ruled out linking to the files inside… May 12, 2026 at 12:02 am

Related Questions

I am new to MVC. I am developing an web application in asp.net MVC.
I am developing an ASP .Net MVC application and on my dev machine, the
I am part of a team that is developing a web application using a
I'm developing an ASP.Net mvc application which has a requirement to do some small,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.