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

  • Home
  • SEARCH
  • 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 7573751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:15:41+00:00 2026-05-30T16:15:41+00:00

I am running a site using MVC 2 and .net 4.0. I recently added

  • 0

I am running a site using MVC 2 and .net 4.0.

I recently added a new partial view to the site that looks like this:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>

<%  if (!(bool)ViewData["Master_ShowGuide"] )
   { %>
   <%= Html.NavigationButton("Guide", "button", "infoIcon", Url.Content("~/Help/ Guide.pdf"), new { title = "Click here to view an in depth user guide." }, new { target="_blank" })%>
<%} %>

What I didn’t notice at the time was the addition of the <dynamic> part to this view, where previously my partials just looked like this:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

This partial was displayed using:

<% Html.RenderPartial("SubLinks"); %>

on my master page.

This appeared to work ok on my development environment, but when deployed to the server, I now run into issues where my ViewData["Master_ShowGuide"] is null. I know that this is not the case, as it is used in other places on the master page just fine.

Can anyone explain why this might be the case – I have ‘fixed’ the issue by removing the <dynamic> type from the partial definition, but I’m curious as to the cause.

If it’s any help, my site runs in an environment with other sites that are running MVC 3.


As a slight addendum, I would note:

  1. The user does not see this error, it just gets reported back to me (through ELMAH).

  2. This code works ok on my test site, but fails with the null reference error on my pre-production deployment site (which is on the same server as the test site and currently running the same code).

I’m a little perplexed.


An answer was found to this issue (as to the root cause of why it is happening), but I’m still not sure why removing dynamic from the partial view declaration would also ‘fix’ it. If anybody can explain, I’d be interested to hear it.

  • 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. Editorial Team
    Editorial Team
    2026-05-30T16:15:42+00:00Added an answer on May 30, 2026 at 4:15 pm

    Found out what the issue was, going to record it for posterity.

    1. Had a url to an image, being generated in a different partial view that was being output using Html.RenderAction. This url was incorrect, resulting in a 404 error being returned.

    This wasn’t noticed on my dev system.

    1. On live, with custom errors enabled in the web.config, this 404 error tried to return a ‘filenotfound’ page that we have. Unfortunately, this error page was using the same master page that was causing the problem in the first place, and it errored out, as did the main ‘error occurred’ page that you were eventually redirected to.

    This resulted in a 500 server error being returned, and this seems to have disrupted the viewdata for the subsequent partial being rendered.

    Hooray for firebug, as this helped me to track this down.

    Hope this helps you out if you find yourself here at some point.

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

Sidebar

Related Questions

So I'm using jqGrid with my mvc.net / Ling2Sql prototype site that I'm making
Like many others on this site I am considering a move to ASP.NET MVC
I have a site built using asp.net mvc running on IIS 7 using integrated
I have an ASP.NET MVC 3 web site that uses Windows Authentication running under
I have a site running MVC and Nhibernate (not fluent) using standard session per
I'm using Asp.Net-Mvc, I have this method in my controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult LinkAccount(string
I have an asp.net mvc 3 site running locally and everything works fine. I
I'm using ASP.NET MVC 1.0 along with the Oracle ASP.NET Membership Providers. I'm running
I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When
Possible Duplicate: Caching in asp.net-mvc i have an asp.net-mvc site and i am running

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.