943,789 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 1091
  • ASP.NET RSS
Sep 3rd, 2009
0

i got the (User.identity.name) blues :(

Expand Post »
What I want to do is get a users current login username, and pass it to an SQL query which will search a table and return all entries belonging to that person. Ive managed to pass the username onto a label when that person logs in.

ASP.NET Syntax (Toggle Plain Text)
  1.  
  2. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  3. Dim theUser = User.Identity.Name
  4. greeting.Text = "hello " & theUser.ToString()
  5. End Sub

I would like to take this a step further by allowing for a pageload event that automaticly querries a table and binds that information unto a datagrid. BTW... I am familiar with the sytax and logic involved with binding a set of records unto a datagrid control. What i am lacking is the knowlege to allow only information that pertains to the logged in user.

Please help,
Rick Pace
Similar Threads
Reputation Points: 9
Solved Threads: 0
Light Poster
ricksvoid is offline Offline
39 posts
since May 2008
Sep 3rd, 2009
1

Re: i got the (User.identity.name) blues :(

vb.net Syntax (Toggle Plain Text)
  1. Dim query As String = "Select * From someTable Where UserName = '" & theUser.ToString() & "'"
Last edited by sknake; Sep 3rd, 2009 at 4:07 pm.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Sep 3rd, 2009
0

Re: i got the (User.identity.name) blues :(

Thanks, that totally worked. It seems i was missing the apostrophes.
ahhh sytax.
Reputation Points: 9
Solved Threads: 0
Light Poster
ricksvoid is offline Offline
39 posts
since May 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Code to authenticate login form
Next Thread in ASP.NET Forum Timeline: Life of Objects





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC