多步向导形式MVC [英] Multi step wizard form with MVC

查看:149
本文介绍了多步向导形式MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刨建立与asp.net的MVC 2一个多步骤的形式所以,我的web应用程序将有5页对应的5个步骤。每一步都有两个提交按钮,previous和明年。每个步骤输入的数据将被存储供以后审查。例如,我们已经为输入步骤1,2,3,4的数据,我们在第5步了。当我点击previous2次,第3步应与我以前输入的数据显示。类似的,当我点击下一步,输入的数据也应该在步骤4中保留的(因为我们是在第3步现在)各工序使用的是非常不同的模式。

I'm planing to build a multi-step form with asp.net mvc 2. So, my web application will have 5 pages correspond to 5 steps. Each step has two submit buttons, previous and next. Input data for each step will be stored for reviewing later. For example, we already inputted data for step s 1,2,3,4 and we are in step 5 now. When I click on "previous" 2 times, step 3 should be displayed with data I inputted before. Similar, when I click "next", inputted data should also be retained in step 4 (since we are in step 3 now) Model used for each step can be very different.

我在寻找一个解决方案来保存数据的每一个步骤。我正想着会话,TempData的,它们都有哪些我要考虑使用的缺点

I'm seeking a solution to save data for each step. I'm thinking about session and tempdata, both of them have disadvantages which I have to consider to use


  1. 会话

  1. Session


  • 默认的会话cookie的是会话,因此,如果Web浏览器未启用cookie的会议将无法正常工作。我也有一个问题在这里,当IE没有的cookie anabled,会话变量都将丢失仅在演员的情况下使用的主机名即可访问Web应用程序。 会话工作正常在IE中使用的IP地址网址

  • 会话Cookie少:并不安全,有很多约束,并与后(http://stackoverflow.com/questions/3972433/mvc2-cookieless-session-issue-using-post或的 http://forums.asp.net/p/1517391/3634908.aspx

  • Default session is cookie session, so session will not work well if web browser doesn't have cookie enabled. I also have a concern here, when IE doesn't have cookie anabled, session variable will be lost only in the case actor uses hostname to access web application. Session works fine in IE with ip address url.
  • Cookies less session: not safe, have many constrains and have an issue with post (http://stackoverflow.com/questions/3972433/mvc2-cookieless-session-issue-using-post or http://forums.asp.net/p/1517391/3634908.aspx)

我真的AP preciate您的咨询!

I really appreciate your advice!

感谢您了!

推荐答案

我总是使用会话。我看到你关于不使用的cookies的人的关注,但我不认为这是一个问题,这些天,因为我不认为有很多用户拒绝饼干。

I always use session. I've seen you concern about the persons not using cookies, but i don't think that is a problem these days as i don't think there are many users denying cookies.

我的会话preference是很容易存储和检索,易于安装。
当你向外扩展(更多台服务器),您可以设置easyly您的应用程序的将sessionState存储在SQL Server数据库所以你为未来做好准备了。

My preference for session is that it's easy to store and retrieve and easy to setup. When you scale out (to more servers) you can easyly setup your application to store the the sessionstate in a sql server database so you're ready for the future too.

隐藏字段我有时用在没有存储步骤之间的敏感信息,因为用户可以编辑隐藏字段的值。

Hidden fields i use sometimes when there is not sensitive information stored between the steps, because the user can edit the value of the hidden fields.

如果有大量的信息岗位之间分享,你不希望有很多隐藏字段,你还可以创建一个对象存储(例如,您将创建的时候,你会在会议STOE吧)序列化对象,基数64 EN code,并将其存储在一个隐藏字段。

If there is a lot of info to share between the posts and you don't want a lot of hidden fields, you can also create an object for your storage (like you would create when you would stoe it in session) and the serialize the object, base64 encode it and store it in ONe hidden field.

这篇关于多步向导形式MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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