I have the following code written in VB. Which grabs hold of the current logged in user and assigns it to a string.
I need to do something similar but in C#. I have a page which is going to populate a gridview depending on the currently logged in user. but for the life of me i cant find a away to assign the current logged in username to a variable.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim cusername As String
If HttpContext.Current.Request.IsAuthenticated Then
cusername = HttpContext.Current.User.Identity.Name End If
SqlDataSource1.SelectCommand = select * from aspnet_membership where email = '" & cusername & "'