Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 17, 2008 05:12 PM by Wargrip
Member
8 Points
7 Posts
Jul 17, 2008 05:06 PM|LINK
Hi, In our application we disable session state but with preview 4 there is an exception raised when loading a controller:
The provider requires SessionState to be enabled.
Into the constructor of my controller but it seems the temp data attempts to load before the controller is executed (according to the stack trace).
Is there any way to disable the loading of the TempData so I don't have to re-enable session state?
Thanks!
Gavin
Jul 17, 2008 05:12 PM|LINK
Nevermind - solved it... if anyone else has this problem, they can use the following code:
{
}
#endregion
Then in the constructor of your controller:
this
Hope this helps someone.
Cheers
Wargrip
Member
8 Points
7 Posts
SessionState required for tempdata in Preview 4
Jul 17, 2008 05:06 PM|LINK
Hi, In our application we disable session state but with preview 4 there is an exception raised when loading a controller:
The provider requires SessionState to be enabled.
I know there is a ITempDataProvider interface now and I tried to add: this.TempDataProvider = null;Into the constructor of my controller but it seems the temp data attempts to load before the controller is executed (according to the stack trace).
Is there any way to disable the loading of the TempData so I don't have to re-enable session state?
Thanks!
Gavin
Wargrip
Member
8 Points
7 Posts
Re: SessionState required for tempdata in Preview 4
Jul 17, 2008 05:12 PM|LINK
Nevermind - solved it... if anyone else has this problem, they can use the following code:
public class NullTempDataProvider : ITempDataProvider{
#region ITempDataProvider Memberspublic TempDataDictionary LoadTempData(){
return new TempDataDictionary();}
public void SaveTempData(TempDataDictionary tempDataDictionary){
}
#endregion
}
Then in the constructor of your controller:
this
.TempDataProvider = new NullTempDataProvider();Hope this helps someone.
Cheers
Gavin