views:

233

answers:

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?

+1  A: 

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.

womp
+ 1 for the simplest solution
David Stratton
A: 

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.

David Stratton
I can't even imagine doing this. Imagine 15 aspx pages code + 15 pages code behind code + peter blum controls code on aspx.. god the one single page you are talking about will have some 7000 lines in aspx and 7000 lines in code behind.. And btw.. I need to support it too ;)..!
Broken Link
Yeah, I think with 15 pages this would be a bad option. Session would probably be a bit easier. I am curious, however, about what kind of applicaiton would need this level of complexity in the first place
David Stratton
A: 

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.

Joel Coehoorn