tags:

views:

78

answers:

4

I use TempData and ViewData to display messages for an asp mvc application. They are part of the Site Master. For some reason, neither TempData or ViewData are showing any information. They do work as expected in the development environment but not in production.

Any ideas of what setting I need to be looking at?

The code is like this:

<% if (TempData["errorMsg"] != null)
   { %>
       <h2><%= TempData["errorMsg"]%></h2>
<% } %>
A: 

Do you have any more information?

Can you be sure that the TempData for errorMsg is being set and not just empty?

griegs
+1  A: 

TempData relies on the Session behind the scenes, so if you have it disabled, or cookies disabled it might not work. As for the ViewData, if you set a value in the controller action there's no reason this value wouldn't show up in the view.

Darin Dimitrov
+1 If production is a load balanced Web Farm instead of a single server that might also cause Session/TempData to not work.
Hightechrider
A: 

Add some logging to your actions and see if the code you expect is realy excuting. I use log4net http://logging.apache.org/log4net/index.html

Malcolm Frexner
A: 

jjhkjhllllllllllllllllluioiokhtm

jk8l9l