跟踪工作流/页面流/用户流管理的最佳方式 - ASP.NET

发布于 2024-08-03 23:26:37 字数 309 浏览 2 评论 0原文

我们仍处于 .NET 1.1

我有一个大约 15 页的小应用程序。工作流程并不像步骤 1、步骤 2 那样简单。但是它非常随机,用户可以从步骤 1 跳到步骤 5 或者非常随机。不仅用户可以跳转,而且由于某些业务规则,我们需要将用户放入相应的步骤 x 中。

我想知道的是如何让这些跟踪变得容易。我的意思是,如果我想在步骤 1 之后将用户发送到步骤 3 并且用户知道步骤 7 的 url,他不应该去那里,他应该去我告诉他去的地方。我的意思是他应该被重定向到步骤 3。

有道理吗?

我的想法是使用会话变量来跟踪用户的下一页。那么有没有更好的办法呢?

We are still in .NET 1.1

I have a small application about 15 pages. The workflow is not simple like step 1, step 2.. But it is very random, user can jump from step 1 to step5 or very randomly. Not only user can jump but due to some business rules we need to put user in respective step x.

What I want to know is how to keep these tracking easy. I mean if I want to send user to step 3 after step 1 and user knows the url for step 7 , he should not able to go there, he should go there where I tell him to go. I mean he should be redirected to step 3.

Makes sense?

The idea I have in mind was to use a session variable, that tracks the users next page. so is there any better way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

带上头具痛哭 2024-08-10 23:26:37

从我从你的描述中收集到的信息来看,会话将是正确的方法。会话用于跟踪临时数据,例如有关请求之间的用户的数据。

Session would be the correct approach from what I can gather from your description. Session is meant for tracking ephemeral data such as this about the user between requests.

何以心动 2024-08-10 23:26:37

如果您使用的是较新版本的框架,我会推荐向导控件。

然而,当我们还在 1.1 时,我也遇到过与你类似的情况,我所做的基本上就是想出我自己的 Wizard 控件。这有点“黑客”,但这是我当时能想到的最好的办法。我不知道是否有人会提出更好的建议(而且我确信有更好、不那么丑陋的方法来实现这一点),但我们是这样处理的:

我们所做的是,而不是采用不同的方法不同页面中的步骤,我们将它们放在一个页面上的不同 ASP:Panel 控件中。我们将面板命名为“PanelStep1”、“PanelStep2”等。

无论如何,我们在隐藏表单字段中跟踪当前索引,并根据该值设置可见面板。

这种方法很丑陋,但它可以解决不允许用户导航到下一步页面顶部的问题(通过将所有步骤都放在一个页面中),并且还允许您控制当前索引(通过将隐藏表单字段的值设置为您需要使用任何事件来设置索引)。它将索引排除在 URL 等之外。

它还提供了将所有收集到的信息都放在一页中的好处。我不知道您是否将信息从一个步骤传递到另一个步骤,或者更新每个页面上数据库中的信息等,但如果您想一次完成所有操作,这将是一种选择。

If you were on a newer version of the Framework I would recommend the Wizard control.

However, I had a situation similar to yours when we were still on 1.1 as well, and what I did was basically come up with my own Wizard control. It was a bit of a "hack" but it was the best I could come up with at the time. I don't know if anyone will come up with a better suggestion (and I'm sure there are better, less ugly ways of accomplishing this), but here is how we handled it:

What we did was, instead of having the different steps in different pages, we put them in different ASP:Panel controls on one page. We named the panels "PanelStep1", "PanelStep2" and so forth.

At any rate, we kept track of the current index in a hidden form field, and set the visible panel based on the value.

This method is ugly, but it would resolve the issue of disallowing a user from navigating top a next step page (by having the steps all in one page) and also allows you to control the Current Index (by setting the hidden form field's value on whatever events you need to use for setting the index). It keeps the index out of the URL, etc.

It also provides the benefit of having ALL of the gathered information available in one page. I don't know if you're passing information from one step to another, or updating a bit if info in a database on each page, etc, but if you want to do it all at once, this would be an option.

不爱素颜 2024-08-10 23:26:37

另一种选择是从 Page 类继承一个新的基页,并在其中放置代码以强制执行正确的工作流程步骤(或者更好的是,在您从那里调用的业务逻辑类库中)。然后让您的每个步骤继承此页面而不是普通的基页面。

One other option is inherit a new base page from the Page class, and put the code to enforce the correct workflow step in there (or better, in a business logic class library that you call from there). Then have each of your steps inherit this page rather than the normal base Page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文