MVC TempData Nighmare

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I created a view, Feedback, that displays a message to the user.

So every time I need to display a message to the user I use the
following:

TempData.Add("Message", message);
return RedirectToAction("Feedback", "Home", TempData);

Message is an object with 3 properties: Title, Description and
IconUrl.

I have been experience 3 problems:

1. When I redirect to feedback its url becomes:


http://localhost:2920/Home/Feedback...2+KeyCollection[System.String,System.Object]&
Values=System.Collections.Generic.Dictionary%602%2BValueCollection
[System.String%2CSystem.Object]

2. When I refresh Feedback view the message disappears;

In part I understand why but how do I preserve it ... and should I
use ViewData instead of TempData for this?

How can I solve these problems?

Could someone, please, help me out?

Thanks,

Miguel
 
Try these two

1. Make the object serializable - this means the object can actually be
broken down into XML
2. Make sure session state is turned on - it is on by default, but you may
have turned off (deleted section of web.config, etc.)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
Back
Top