开发者

How to set Session Variable in C# Using ContentUpdate

开发者 https://www.devze.com 2023-02-19 03:32 出处:网络
Well, the question seems very straightforward, but it isn\'t. I want to set a session variable like the following:

Well, the question seems very straightforward, but it isn't.

I want to set a session variable like the following:

Session["myS开发者_开发知识库ession"] = "Some Value";

But I want to do so when clicking on a button, and using ContentUpdate:

protected void myButtonClick(object sender, EventArgs e)
{
    Session["mySession"] = "Some Value";
}

and

<asp:Button ID="myButton" runat="server" OnClick="myButtonClick" />

Ok, so far so good. It works, and it has always worked. Now let's talk about the problem.

The only way I can get it working on an iPhone is to set session variable is on the Page_Load function. It works when browsing from my computer.

So, I guess my question is:

How to set a Session Variable in C# Using ContentUpdate on an Iphone?


have you checked your iphone is accepting cookies? -i know you are using session but a cookie is needed to estabish a session.


I found a way around the problem, not the solution I wanted, but it worked for what I needed.

I was using the Session[] variable and found out about the Application[] variable and switch them... tadaaa... it worked!

Does anybody know why, and could share their knowledge?

Thank you for the comments posted.

0

精彩评论

暂无评论...
验证码 换一张
取 消