I am currently working on "My information" page for the users. I am using VS's own create user wizard and its own database. But I am confused to get inofrmation of the user that is logged in. My database's name is(aspnetdb.mdf) and I have an sqldatasource
(called sqldatasource1). Now what I want datasource to do is retreiving the data of the user that is logged in. For example My user name is "Admin". When I open "My information Page" datasource will retrieve the informiaton where column username(in the DB)
equals "Admin"(the username). How can I do that. I tried some codes but they didn't work. WHen I write them gridview comes empty. I tried (User.IDentity.Name) But it didn't work.
First of all thank you for your answer. The artciles are really great but unfortunately ı couldn't find my answer :( In admin page I can get user's info. that's okay. But plus that I want users to see their own information in a page.
Mac14
Member
46 Points
71 Posts
Getting user's information
Jan 25, 2013 04:42 PM|LINK
Hello dear all!
I am currently working on "My information" page for the users. I am using VS's own create user wizard and its own database. But I am confused to get inofrmation of the user that is logged in. My database's name is(aspnetdb.mdf) and I have an sqldatasource (called sqldatasource1). Now what I want datasource to do is retreiving the data of the user that is logged in. For example My user name is "Admin". When I open "My information Page" datasource will retrieve the informiaton where column username(in the DB) equals "Admin"(the username). How can I do that. I tried some codes but they didn't work. WHen I write them gridview comes empty. I tried (User.IDentity.Name) But it didn't work.
I am waiting for your answers
Thanks!
mebinici
Participant
815 Points
256 Posts
Re: Getting user's information
Jan 25, 2013 10:06 PM|LINK
Seems like you need to setup the ASP.NET Membership roles/providers.
Do you want users to create, login and view pages?
If so, then read this:http://weblogs.asp.net/scottgu/archive/2006/05/07/ASP.NET-2.0-Membership-and-Roles-Tutorial-Series.aspx
You can create your own "users" table/objects, but Microsoft has it built in already.
Love collecting video games, movies and board games!
Enjoying my '11 WRX, so sexy...
Mac14
Member
46 Points
71 Posts
Re: Getting user's information
Jan 27, 2013 06:28 AM|LINK
Hello!
First of all thank you for your answer. The artciles are really great but unfortunately ı couldn't find my answer :( In admin page I can get user's info. that's okay. But plus that I want users to see their own information in a page.
Thanks!
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Getting user's information
Jan 31, 2013 01:21 AM|LINK
Just use the specific user's Info such as ID to query out all the info from the user and use output to page.