View Single Post
  #1 (permalink)  
Old January 25th, 2009, 10:20 AM
Spider Spider is offline
Authorized User
Join Date: Jan 2009
Posts: 23
Thanks: 10
Thanked 0 Times in 0 Posts
Default Displaying data based on user logged in

First of all - I hope I have posted this in the correct place - if not; please bear with me as I am new to using forums. Thanks.

I am also relatively new to ASP.NET and am experiencing a steep learning curve as I work on a current assignment.

The biggest problem I am having at the moment is with user profiles / log-ins. I am using Visual Web Developer 2008 Express and have been able to get a basic login function to work using the wizards provided in the software. So I can create a new user and then log in as this user. I also have it displaying the name of the logged in user on the page when login has been successful.

I know this information is being stored in the ASPNETDB.mdf, which Visual Web Developer creates for you.

I have my own sql database which will store personal information, (address etc) and rather than try to merge the two I eventually want to link ASPNETDB.mdf with my own, based possibly on the unique user code it provides. However this is not what I am having issue with at the moment (although if you have advice on best practice I am keen to hear it!)

I want to begin to expand the site to show only information relevant to the logged in user - for example initially to use information only from ASPNETDB.mdf, so to display the user code for the logged in user.

To try and achieve this I have followed through creating a datagrid and linking it to a datasource. I realise I must somehow need to specify that the data displayed is only that of the logged in user. I follow through configuring a connection string, and including a Where clause, to try and pick up the logged in user, but this is where it falls apart on me! I don't know where the source I am picking the user name up from needs to be - for example from a session, cookie, form, profile.

I can get it to work in the test; (when I use the 'profile' value as 'username') but this is because I am typing in the user name - I need it to recognise the name of the logged in user as opposed to have them type it each time.

I realise this is a bit garbled but if you can understand what I am trying to do and could offer any help / suggestions, that would be most appreciated. I feel once I get past this hurdle I will be able to make substancial progress, but I have been stumped at this for a while.