tags:

views:

129

answers:

1

HI i am getting error : "The SessionStateTempDataProvider requires SessionState to be enabled." when i try to handle the error. i got a piece of code from the blog below. http://blogs.microsoft.co.il/blogs/shay/archive/2009/03/06/real-world-error-hadnling-in-asp-net-mvc-rc2.aspx i am not using any session. my session state is set to off in web.config.

and from the below thread http://stackoverflow.com/questions/720367/the-sessionstatetempdataprovider-requires-sessionstate-to-be-enabled i got a solution to set the but its already set as such. how to avoid the error. i dont want to use session.

A: 

my session state is set to off in web.config.

That should be what's causing the problem. Apparently, ASP.NET MVC needs the session state.

Check this question about disabling session state.

çağdaş
sorry for my statement, "my session state is set to off in web.config"i am not setting <sessionState mode="Off" /> in my web.config.i tried searching the text, but couldnt find it.
Nimesh
@Nimesh, it must have something to do with the SessionState being disabled. Because that's the only way I am able to reproduce the error. Plus, that's what the error message suggests.
çağdaş
yeah i agree to your point. but i am not able to extract that out.is there any other ways to handle errors?
Nimesh
Of course. The base controller has a virtual method called `HandleUnknownAction`. You can have your own base controller, derived from the `Controller` class and handle 404 errors there. You can also have your own `HandleError` attribute to hande errors occured on controllers/actions. Example : http://stackoverflow.com/questions/766610/how-to-get-elmah-to-work-with-asp-net-mvc-handleerror-attribute
çağdaş