Here I am trying to pass a String variable from one page to another using session.. But it gives an error.. Please help... Here is my coding
在这里,我试图使用会话将一个String变量从一个页面传递到另一个页面..但它给出了一个错误..请帮助...这是我的编码
//this is for sending
Session["themeColor"] = "Sky Blue";
//this is for retriving
String themeColor = Session["themeColor"].ToString();
1 个解决方案
#1
2
If you are using Web Site try enableSessionState like this:
如果您正在使用网站,请尝试使用enableSessionState:
<pages enableSessionState="true">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
#1
2
If you are using Web Site try enableSessionState like this:
如果您正在使用网站,请尝试使用enableSessionState:
<pages enableSessionState="true">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>