tags:

views:

73

answers:

2

In an ASP.NET 3.5 site we have a relatively standard payment checkout progess that contains a number of pages that need to be visited in sequence (shopping basket, payment details etc)

Each page has a "Continue" button that redirects to the next page in the sequence.

I would like a way of managing the page sequence so that:

  1. I can have a Master page that defines the "Continue" button and its code-behind OnClick event handler
  2. If the user attempts to visit a page out of sequence (by typing the URL directly into their browser, for example) they get redirected to the correct page
  3. This page sequence is nicely defined in one place in my code (in an enum for example)
+3  A: 

Why not use the ASP.NET Wizard control?

Alternatively (and I haven't tried it so I can't say how well it works), you could use Windows Workflow to define a sequential workflow and let that control the order pages come up in. There's an article at http://www.devx.com/dotnet/Article/34732 that takes you through doing it this way.

PhilPursglove
Thanks for that Phil - I've not used the Wizard control before but it looks pretty good. However I'd rather have something that still allows the user to use their browser Back button to go back to the previous step in the payment process.
Richard Ev
A: 

Check the HttpRequest.UrlReferrer variable in each Page_Load method...

http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx

... and don't forget to check for nulls! You can bounce them to where they are supposed to be, based on where they came from.

protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["PreviousPage"] = Request.UrlReferrer.ToString(); ... } else { ... } }

Anthony, www.codersbarn.com :-)

IrishChieftain