Question

Using http handlers I am redirecting the users to some other page. Example: if we enter about.aspx, i will redirect the user to page.aspx?pageid=20 using server.transfer. But the problem is,in page.aspx at following statement i am getting below error. session["userid"]= "xyz";

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration.

Was it helpful?

Solution

If you want to access session state in httphandler, you have to implement IRequiresSessionState interface along with IHttpHandler.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top