Session["Sample1"] = Value1;
Session["Sample2"] = Value2;
I have given EnableSessionState in the Page Directive. In the web.config file, the sessionstate tag is as shown below:
<
sessionState mode="Inproc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="server=127.0.0.1;Trusted_Connection=yes" cookieless="true" timeout="20" /> But i am getting the following error:
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive
I have looked google for help and found some articles as below:
http://dotnet247.com/247reference/msgs/24/124005.aspx
http://www.kdkeys.net/forums/376/ShowPost.aspx
http://www.visual-basic-data-mining.net/forum/PrintPost.aspx?PostID=376
After going through the above links i have added:
override
protected void OnInit(EventArgs e) {
// // CODEGEN: This call is required by the ASP.NET Web Form Designer. InitializeComponent();
string name1= (string)Session["Sample1"]; string name2 = (string)Session["Sample2"]; base.OnInit(e); }
But i am still getting the same error!!!!![]()
Please let me know how i can solve this problem................
Thanks in advance
Regards
Lakshmi
(http://techsavygal.blogspot.com)