473,471 Members | 4,650 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ASP.NET 2.0 UserName of Currently Logged in User

12 New Member
Hi, can anyone advise me how I can access the UserName of a currently logged in user without using the LoginName control.

For instance I want to search tables I have created in my database that I have referenced by UserName as a foreign key. This is straightforward if I can identify what the currently logged in user's username is. But I can't??

I have tried Environment.UserName but this simply provides the username of my computer, rather than the currently logged in username of the application.

How can I access the Membership provider information such as UserName and UserID from the code of any website template?

Kind Regards,

GI
Aug 1 '07 #1
2 9533
Plater
7,872 Recognized Expert Expert
If you set in web.config that WindowsAuthentication is to be used for that aspx page, you can then retrieve the windows LoginID of that person.

I have a section where I require windows authentication then in my aspx page I used:
Expand|Select|Wrap|Line Numbers
  1. Logged in user: <%=User.Identity.Name %>
  2.  
Note: You can use User.Identity.Name and the like in backend code as well.
Aug 1 '07 #2
gihope
12 New Member
That is magical and has ended hours of torment.

I'd eventually given up and tried as a work around creating a UserID profile variable at registration for anonymous users, and then converting it to a registered user variable which I could use in the templates as Profile.UserID.

I was still trying to figure out where to put the conversion event when I read this.

Result.

Thankfully I can scrap all that right now and use the clean method instead...

Thank you very much! GI
Aug 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: DMc2004 | last post by:
I have serveral items I would to find out how to do: 1) How to get the username of the person currently logged onto a workstation; 2) How to get the username of who is logged onto a different...
1
by: ChrisB4745 | last post by:
I'm working on a system service application that is supposed to report various information about the computer it is running on back to a central server. One of the things I need to know is the...
4
by: 1qa2ws | last post by:
Hi, I need to get the windows current logged username and domain. Is it any possibility? 1qa2ws
14
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the...
6
by: John Dalberg | last post by:
I want to automate the process of logging into an intranet. I want to pull out the username of the Windows user logged into the machine running the browser and use the username in my app. How can I...
1
by: Sudhakara.T.P. | last post by:
Hi, I have an application in VB.NET windows application, wherein the administrator has the option to change the authentication mode ie., whether the application should work as a normal database...
2
by: boyleyc | last post by:
Hi all I am trying to retrieve the SQL username for the currently logged on user from my backend SQL Database so i can populate a form. I have the following 2 procedures. However obviously...
6
xxoulmate
by: xxoulmate | last post by:
how to get the IP address or computer name of a username logged on the network., i got nbtscan which scan ip address on the network and display the username currently log on the computer., what i...
2
by: sgawas01 | last post by:
i want the username of currently logged in user on client machine. want to use it for intranet authentication. i dont want my application to show any popup asking for username and password. it...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.