Re: how to get users details
- From: kaza <kazazic@xxxxxxxxx>
- Date: Sun, 25 Nov 2007 03:05:18 -0800 (PST)
On Nov 24, 11:51 pm, James <Ja...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi
Well Im using email address instead of username for a few reasons, first I
dont like having to think up usernames all the time, and usualy the ones I
want are taken. Second I can never rember my username. But mainly because its
easier, everyone knows their email address, and I am working with an exsiting
database so rather than get everyone to come up with a username just email
them a password.
I have got the custom Validate User function now, and think I do it by
adding a line in like:
HttpContext.Current.Session("UserID") = reader.GetValue(1)
This should get the first column in the row for the persons record when they
are being validated. Problem is that is returns a Null.
I could be doing this the wrong way, but at the moment when the user opens
pages to view their orders etc, the datasource SQL is SELECT * FROM orders
WHERE email = User.Identity.Name. So if they change their email after loggin
in
it wont match.
Plus it is awkward putting email address into the orders table, when there
is already the memid field there.
"Barrie Wilson" wrote:
I'm not sure I fully understand what you're doing and why you're doing it
..... but ...
why does User ID have to change when a user changes email addresses?
when they change their email address, on submit you execute:
UPDATE userTable SET email = newEmail WHERE memid = frmMemid
I'm not clear why anything would be out of date; you're only changing the
email column and the new one is now associated with memID and UserID, no?
forget dLookup from VB ... it's a relic from your past .... you can do
whatever you need to do with ADO.NET/T-SQL ...
conceptually, I don't know why you don't just view the email address as the
UserID, at least for login purposes, rather than as a separate entity ... in
other words, I guess I'm unclear why you needed to customize the login
control at all ... bob234 is a string of characters and so is b...@xxxxxxx
.....
"James" <Ja...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D15911BF-83C8-48D4-B825-ECF7B791E2F9@xxxxxxxxxxxxxxxx
Hello
I have customised the login on my site, so the person uses their email
address and password to log in, rather than a user name.
At the moment when a user logs in have a line:
Session("UserID") = User.Identity.Name
Which as they log in using their email address gives the UserID the value
of
the email address. This works great, until they change their email
address.
Then UserID does not equal any email addresses in the system as it is out
of
date, and therefore pages come up blank with no data, so they need to log
off
and back on again.
The table has a unique primary key that links the tables together (called
memid). It would be best to use this value as they cannot change it.
So either:
1, How can I update the UserID when they change their email address
2, Or is there a way of looking up other information other than the Name,
EG: Dlookup("memid","members","emailaddress=" & user.identity.name)
Dlookup is something I know from VB and it does not seem to be in ASP, but
is there something similar?
Any other suggestions welcome.
Thanks
James- Hide quoted text -
- Show quoted text -
is your pirmary key in table user-email adress? if yes why?
usually it is not a good idea to have something like that (primary key
which changes) instead make primary key an interger (auto-increment)
and use column email adress as unique but not as primary key, after
login write intos session variable this integer which will never
changen, this will make your life much much easier.
otherwise update the records as sugessted above
regards
.
- References:
- Re: how to get users details
- From: Barrie Wilson
- Re: how to get users details
- From: James
- Re: how to get users details
- Prev by Date: Re: Determining the Default Printer
- Next by Date: Re: how to get users details
- Previous by thread: Re: how to get users details
- Next by thread: Sending Mail from asp.net for Gmail ID
- Index(es):
Relevant Pages
|