Re: Please! Doesn't anyone know a better way to do this?

Well you've got it partially right. We will be storing the user's name &
password (right now the application is set up as a "Demo") What I'm trying
to do is direct the user from page to page - i.e., after the user sets up an
account, they need to automatically be directed to the page to enter data
for the fleet (this is a Fleet vehicle registration application) and after
they enter the fleet info they need to be directed to the vehicle
registration section. This is actually quite easy the way that I'm doing it
with Session Variables (in the directory if they chose Add Account I set a
session variable on the Account page (Session("page_name"). This session
variable gets changed as they flow from window to window using the Next
button. If they use the JavaScript drop-down menu instead, the session
variable doesn't get set and the next page doesn't "know" where it was
called from...does that make more sense? I'm using .Net 1.1 right now but
we are (supposed) to be upgrading to .Net 2005 (ASPX 2.0). I just can't
think of a better way to "tell" my pages which page the call originated there another way that the JavaScript menus won't interfere with?
Thanks very much for any/all help :-)

"Dblood" <dbloodworth@xxxxxxxxxxxxxxx> wrote in message

I'm having trouble understanding exactly what you want to do, but from
what I gather, you need to know when a new user comes in and handle
them differently than an existing user. Let's break down your request,
with some additional questions inline.

...when they login,
if they are a new user, a new account screen comes up

I assume here that you're checking a database when the user attempts to
login and if the user isn't found you want to redirect to the "new user
signup" -or- the user clicks a "register" button to get to the signup
page. Correct?

from there a
series of screens need to be entered in a specific order.

You have a "wizard type" progression that you want to perform here?

Then, depending
on what they select after they have completed the new account info, the
needs to direct them from the entry screens to invoices, payments,
electronic signature and receipts pages.

You want the choices they've made to dictate where they are sent
afterwards, and these options are saved in the database with each user

I currently am using
Session State (variables) and pass them from the directory page to the
called. The problem with this is that we also have a JavaScript
menu and the variables don't get set if they select a page from the drop
down. How do I overcome this limitation? Isn't there a better way to

This kinda sounds like you're not storing the user's options in the
database, please correct me if I'm wrong.


Here's how I'd attack this if it were my problem. There are many ways
to do it, but this is my OPINION (as I don my flame retardant gear).

When a new user attempts to login or clicks to register, I'd redirect
them to my new user signup. I'd use server-side HTML tables to house
each "page" of the signup process (all on one aspx page), and control
the user's progress with a hidden textbox's value. I'd use next and
back buttons to increment the hidden textbox's value. I'd use a Select
Case on that value in the code-behind to determine which table needed
to be visible (only 1 table "Page" visible at a time).

For instance:
<Table id=tblSignUp1 runat=server>
[Sign up Procedure - Page 1 (Your HTML for Page 1)]
<Table id=tblSignUp2 runat=server visible=False>
[Sign up Procedure - Page 2 (Your HTML for Page 2)]
<Table id=tblSignUp3 runat=server visible=False>
[Sign up Procedure - Page 3 (Your HTML for Page 3)]
<asp:button id=btnNext text="Next" runat=server></asp:button>
<asp:button id=btnBack text="Back" runat=server></asp:button>
<input type=hidden name="txtStep">

(code-behind in PageLoad of Signup.aspx)
Dim myStepNum as Int16
myStepNum = Cint(Request.Parameters("txtStep"))

Select Case myStepNum
Case 1 'Display page 1
tblSignUp1.Visible = True
tblSignUp2.Visible = False
tblSignUp3.Visible = False
Case 2 'Display page 2
tblSignUp1.Visible = False
tblSignUp2.Visible = True
tblSignUp3.Visible = False
Case 3 'Display page 3
tblSignUp1.Visible = False
tblSignUp2.Visible = False
tblSignUp3.Visible = True
End Select

When the user clicks "DONE", I'd insert a new record into the DB and
(in a separate table) add all the user's options. I'd then redirect
the user back to the login page. The login procedure should add the
user's ID to Context.Session.Item("user_id") - [from the DB during
login if the user is validated]

Then, I would create a class called usersettings. On each page load,
I'd instantiate the usersettings class and load all the user's info
into my class variable through a query to the database based upon my
Context.Session.Item("user_id") value. I'd create a method to handle
this population.

Something like this:
Public Class usersettings
Public Structure oUser
Public UID as int16
Public setting1 as string
Public setting2 as string
End Structure

Public Function GetSettings(ByVal user_id as Int16) as oUser
Dim currentUser as oUser
[connect to database and retrieve settings]
currentUser.UID = user_id
currentUser.setting1 = myDataView(0).Row("Setting1")
Return currentUser
End Function
End Class

[Page Load]
Dim tmp as New usersettings
Dim myUser as oUser
myUser = tmp.GetUserInfo(Context.Session.Item("user_id"))
tmp = Nothing

This way, I have all the user info at my disposal before anything else
on the page happens. You could probably do this in Global.asax in the
BeginRequest event too. I'll leave that for later.

Not sure how the java menu's will affect this approach because I don't
use them.

Maybe this is a start for you, maybe I'm completely off base as far as
the questions you asked, and maybe someone will tell me that this is a
horrible approach, but I've used this successfully in the past. The
code included wasn't compiled and is really just a Psuedo-code example.

Let me know if it helps. Good luck



Relevant Pages

  • Re: PDO: Switch database user without reopening connection
    ... At the bare minimum there will be a login user who only has ... modifications to the database as well (editors get update permission, ... As database connections are expensive to ... a certain visitor in the Session, and use that value to start the right ...
  • Re: PDO: Switch database user without reopening connection
    ... At the bare minimum there will be a login user who only has ... the postgres user they are logged in as to one that can make ... modifications to the database as well (editors get update permission, ... a certain visitor in the Session, and use that value to start the right ...
  • Re: PDO: Switch database user without reopening connection
    ... At the bare minimum there will be a login user who only has ... modifications to the database as well (editors get update permission, ... open PDO and create a new one, in other words disconnect from the ... a certain visitor in the Session, and use that value to start the right ...
  • Re: Fix: Error connecting to existing session
    ... Was your other account a member of the administrator group? ... Remote Networking Technology Support Site - ... >login session was created from the console or remotely, ... >login under an alternative admin account and kill the initial session ...
  • Re: ASP.Net [2.0] - SessionID
    ... Have you tried using the built-in profiles system to perform queries on thousands of users without retrieving every user? ... It's not exactly rocket science, a session is created, its ID and user ID are written to the database, each page that requires authentication checks to see if there is a current identity and if so then tries to match that to the one in the database - if everythings ok - great - more on - if not - redirect to the login page. ...