在ASP.NET如何,你处理会话和多个标签? [英] How in ASP.NET, do you deal with session and multiple tabs?

查看:124
本文介绍了在ASP.NET如何,你处理会话和多个标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写在ASP.net应用程序,被设计为让用户记录添加到数据库中。该页面设置,当用户添加一条记录,新添加的记录的ID号在会话设置,页面Response.Redirects一个感谢您提交页面,然后重定向回到原来的页面,让进一步的编辑。用户还可以使用此屏幕上的后退按钮返回到原来的记录添加页面,这使得他们能够进行编辑的数据。

I have written an application in ASP.net, that is designed to let the user add records to a database. The page is set up that when a user adds a record, the ID number of the newly added record is set in session, the page Response.Redirects to a "Thank you for submitting" page, then redirects back to the original page to allow further edits. Users can also use the Back button on this screen to go back to the original record adding page, which allows them to make edits to the data.

不过,我发现,存储ID在会话不是一个非常好的解决方案,因为用户可能试图在不同的标签或窗口两个文件。我还试图在字面控制设定的ID,而这会导致,当用户使用Back按钮,字面控制未设置于ID的问题,并且新记录被添加,而不是一个正在编辑

However, I have found that storing the ID in session isn't a terribly good solution, as a user might try to create two documents in different tabs or windows. I have also tried setting the ID in a literal control, but this causes the problem that when the user uses the Back button, the literal control isn't set to the ID, and new records get added instead of one being edited.

对此有任何一种解决方案?

Is there any kind of solution for this?

推荐答案

愚蠢的问题,为什么可以在用户使用后退按钮编辑只是在后接受的数据?

Silly question, why can the user use the back button to edit the data just accepted in a post?

如果编辑previously发布的数据是一个常见的​​场景为什么不直接重定向到一个页面时,数据被接受,让他们对其进行编辑。这时如果点击后退按钮,他们将回到原来的干净插入/添加新的数据页。

If the edit previously posted data is a common scenario why not just redirect to a page when the data is accepted that lets them edit it. Then if the hit the back button they would be going back to the original "clean" insert/add new data page.

这将使以下流
添加 - > [发布] - >编辑 - > .....
添加 - > [发布] - >编辑 - > [返回按钮 - >添加 - > [发布] - >编辑 - > [发布] - >编辑...

This would give the following flows Add->[Post]->Edit->..... Add->[Post]->Edit->[Back button]->Add->[Post]->Edit->[Post]->Edit....

这篇关于在ASP.NET如何,你处理会话和多个标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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