Last post Jan 30, 2013 09:21 PM by Decker Dong - MSFT
Jan 25, 2013 12:42 PM|Mac14|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
Jan 25, 2013 06:06 PM|mebinici|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.
Jan 27, 2013 02:28 AM|Mac14|LINK
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.
Jan 30, 2013 09:21 PM|Decker Dong - MSFT|LINK
But plus that I want users to see their own information in a page.
Just use the specific user's Info such as ID to query out all the info from the user and use output to page.