473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

MemberShip.GetUser() and login control

Hello group,

i'm trying to load some additionally stored information to a user at
login time.

That data is self created and stored in an sql database.

I hooked in the login control definiton with : OnLoggedIn="loadMyUserData"

The following code should show what i'm trying to do (i removed the part
of working with this data) :

public void loadMyUserData(object sender, EventArgs e)
{
ContactDetailsService.getInstance().getContactDeta ilsForUser(Membership.GetUser());
}

I get a null reference exception, so MemberShip.GetUser() does not know
about the currently logged in user at this time.

My question is, where can i hook to access the currently logged in user
during this login process and before the user is automatically
redirected to the specified page? I know that i could read the username
from the login form, get the MemberShipUser for that username and pass
this, but it seems not nice.

Any ideas?

Thanks in advance

Florian
Sep 1 '08 #1
2 5551
The authentication principal won't get set until the next request to the
server. That's why GetUser returns null. But you can use the "UserName"
property of the Login control. With this name, you can use
Membership.GetUser(userName).
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Florian Paulus" <fl************@sc-cis.dewrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hello group,

i'm trying to load some additionally stored information to a user at login
time.

That data is self created and stored in an sql database.

I hooked in the login control definiton with : OnLoggedIn="loadMyUserData"

The following code should show what i'm trying to do (i removed the part
of working with this data) :

public void loadMyUserData(object sender, EventArgs e)
{
ContactDetailsService.getInstance().getContactDeta ilsForUser(Membership.GetUser());
}

I get a null reference exception, so MemberShip.GetUser() does not know
about the currently logged in user at this time.

My question is, where can i hook to access the currently logged in user
during this login process and before the user is automatically redirected
to the specified page? I know that i could read the username from the
login form, get the MemberShipUser for that username and pass this, but it
seems not nice.

Any ideas?

Thanks in advance

Florian

Sep 2 '08 #2
Eliyahu Goldin wrote:
The authentication principal won't get set until the next request to the
server. That's why GetUser returns null. But you can use the "UserName"
property of the Login control. With this name, you can use
Membership.GetUser(userName).

Thank you for your answer, so seems i'll have to do it that way.

Florian
Sep 3 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pete | last post by:
Hi, Quick question about the login control. I'm intercepting the OnLoggedIn event and doing the following: MembershipUser user = Membership.GetUser(); However, the user object is always null...
1
by: EricRybarczyk | last post by:
I am starting a rewrite of an existing Classic ASP web site in ASP.NET 2.0. The existing ASP application has several types of users, each with a separate login process (separate login page,...
2
by: ad | last post by:
I use login control of VS2005 in my web application. The web applicaiton is developed in my notebook. It run ok in my notebook, but when I login in from another PC with the user ID and password,...
5
by: Afshar | last post by:
Hi everybody there, I have a special Login page that wants users to enter 3 passwords rather than a single password. But can't do it with Login control. I tried following scenarios: 1. Put an...
2
by: Jav | last post by:
I need to get at the ProviderUserKey of the logged in user. I would have thought that I could do something like: Dim u As MembershipUser = Membership.GetUser Dim ProvKey as Guid =...
3
by: goot | last post by:
I'm trying to use the login control and have it use the membership provider framework to authenticate users and am having a problem (which i'm sure will turn out to be a stupid mistake on my...
0
by: chris | last post by:
I've been thinking about adding to my asp.net 2.0 web project (ecommerce) the use of the membership and login control capability. I've read a lot but still don't quite understand the practical use....
3
by: Nightcrawler | last post by:
Hi, I have a blog in my application that any registered user can post to (I am using Microsoft's Memberships and Profiles for this). When I show the blog entries in a datalist I also want to...
2
by: Nightcrawler | last post by:
I recently started to use MemberShip, Roles, and User to build a portal site in asp.net 2.0. I currently have set the web.config to only store registered users in the database. I don't want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.