从头到尾在会话中存储数据. [英] To store data in session from start to finish.

查看:63
本文介绍了从头到尾在会话中存储数据.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个问题,例如我已经用c#在asp.net中创建了一个Web应用程序,并且它正在运行.它有14页,但是问题是,如果用户要返回并更新最后一个值,那么当他返回所有最后一个条目时,它们都到期了,他不知道在最后一页上选择了什么,并且在同一时间选择了什么如果他再次选择任何值并单击下一步按钮,那么他在下一页上选择的值也将过期.

我希望该用户可以随时返回并更新值,直到到达最后一页,并且有20个用户同时使用该应用程序.我知道这与会话有关,但是如何在正确的教程中使用它我不知道.所以请帮我解决这个问题.

这就像在线测试一样,因此同时任何数量的用户都可以访问此应用程序,并且如果他们要更改在最后一页上提到的内容,可以从首页更改为最后一页.

Hi ALL,

I have a problem like i have created a web application in asp.net with c# and it is working. it has 14 pages but the problem is if the user want to go back and update the last value then when he go back all the last entries got expired and he does''nt know what was he selected on the last page and at the same time if he again select any value and click the next button then the value he was selected on the next page is also expired.

I want that user can go back and next any time and update the values untill he reach the last page and 20 users use the application at the same time.I know that it is something related to session but how to use it in a right mannar that i do''nt know.SO please help me out to resolve this query.

This is something like online test so at the same time any number of user can access this application and if they want to change something that they mentioned on the last page can change from first page to last.

推荐答案

使用会话很容易:
Using Session is easy:
Session["MySessionVariable"] = myVariableValue;
...
myVariableValue = (MyVariableType) Session["MySessionVariable"];

所有您需要做的在页面上放置一个下一步"按钮,然后在Click事件处理程序中设置Session变量,然后再移至该页面.加载页面时,yopu会在Load事件中读回会话变量,并适当地设置文本框内容.

由于会话保存对象值,因此您可以存储所需的任何类型.

So all you have to do is put a "next" button on you page, and in the Click event handler set the Session variables before you move to the page. When you load a page, yopu read teh session variables back in the Load event, and set the textbox content appropriately.

Because Session holds object values, you can store whatever type you need.


这篇关于从头到尾在会话中存储数据.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆