Using a NullTempDataProvider crashes at PossiblyLoadTempData()
Posted
by Jova
on Stack Overflow
See other posts from Stack Overflow
or by Jova
Published on 2010-04-27T12:11:44Z
Indexed on
2010/04/27
12:13 UTC
Read the original article
Hit count: 285
I'm trying to use a dummy TempDataProvider for some of my controllers.
The provider looks like this.
public class NullTempDataProvider : ITempDataProvider {
public IDictionary<string, object> LoadTempData(ControllerContext controllerContext) {
return new TempDataDictionary();
}
public void SaveTempData(ControllerContext controllerContext, IDictionary<string, object> values) {
}
}
But I'm getting an error that says
System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.Mvc.Controller.PossiblyLoadTempData()
Any help for figuring out the reason for it is much appreciated.
© Stack Overflow or respective owner