Unable to assign and read value from session
We have implemented mvc grid in our Application. We have a requirement that we need to assign and read the session values in MVC grid config but the session is always showing as null even we have session in our application. Can we assign and read the session values in mvc grid?. We are stuck at this point, Can any body please help us asap.
Can someone please look into this issue
This would be possible but the dll would need to be recompiled with IRequiresSessionState implemented on the MVCGridHandler like this:
public class MVCGridHandler : IHttpHandler, IRequiresSessionState
Why don't you add this as default? I think many users needs to access HttpContext inside MvcGridConfig. There shouldn't be need to do a custom build just for single inheritance.
I need the same thing, tryed to put Httpcontext to get current session and I get a null value.
Hello, Any solution for this issue? Regards,
@joeharrison714 suggested a solution that works so I'll elaborate on it.
Disclaimer: all references here are from the project as of 2019.12.31
-
Fetch an instance of the MVCGrid.Net project from https://github.com/joeharrison714/MVCGrid.Net
-
Go to the
MVCGridHandlerfile located atMVCGrid\Web\MVCGridHandler.cs -
Have
MVCGridHandlerinherit from theIRequiresSessionStateby adding a using reference to theSystem.Web.SessionStatenamespace such that lines 16-20 are rewritten as:
using System.Web.SessionState;
namespace MVCGrid.Web
{
public class MVCGridHandler : IHttpHandler, IRequiresSessionState