473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

client login name

Hello,

I have to identify the user of an asp.net site by his windows login
name (like environment.currentuser in Access). Till a few days I'm
trying several scripts I've found. For example one like this:
strLogonName =
System.Security.Principal.WindowsIdentity.GetCurre nt().Name

The best result was to display the asp-account on the Server. But I
need the username on the client.

We are working in a windows2k environment with iis 6 and asp.net 1.1.

Thanks for help!

Nov 19 '05 #1
6 1897
Give HttpContext.User.Identity.Name a try...pretty sure that's what
you're looking for.

Nov 19 '05 #2
catweezle2010 wrote:
Hello,

I have to identify the user of an asp.net site by his windows login
name (like environment.currentuser in Access). Till a few days I'm
trying several scripts I've found. For example one like this:
strLogonName =
System.Security.Principal.WindowsIdentity.GetCurre nt().Name

The best result was to display the asp-account on the Server. But I
need the username on the client.

We are working in a windows2k environment with iis 6 and asp.net 1.1.

Thanks for help!


If your site allows anonymous access (in IIS !), then you will never get
a login-name. So clear that checkbox.
Then you can use
this.Page.User as WindowsPrincipal
to get at the login data.

Hans Kesting
Nov 19 '05 #3
Thanks - now have an error which I had not before:
Compiler Error Message: BC30469: Reference to a non-shared member
requires an object reference.
The code: strLogonName = HttpContext.User.Identity.Name

Nov 19 '05 #4
In your scenario, you can

1) Set Windows authentication:
in Web.Config file
<authentication mode="Windows"/>

2) Deny anonymous access
in Web.Config file
<authorization>
<deny users="?" /> <!-- Deny anonymous users -->
<allow users="*"/> <!-- Allow all other users -->
</authorization>

3) Then use
User.Identity.Name
to get Domain_Name\User_Win_Login_ID

HTH

Elton Wang
el********@hotmail.com


"catweezle2010" wrote:
Hello,

I have to identify the user of an asp.net site by his windows login
name (like environment.currentuser in Access). Till a few days I'm
trying several scripts I've found. For example one like this:
strLogonName =
System.Security.Principal.WindowsIdentity.GetCurre nt().Name

The best result was to display the asp-account on the Server. But I
need the username on the client.

We are working in a windows2k environment with iis 6 and asp.net 1.1.

Thanks for help!

Nov 19 '05 #5
Thanks to all, a long search is ending here.

@Elton W: I allready used user.identity.name but failed.

My settings in IIS an web.config were right, but it seems they do not
work without the <autorization> part in web.config.

So thanks a lot. Maybe you can help me in my next post (loosing session
value).

Nov 19 '05 #6
catweezle2010 wrote:
Thanks - now have an error which I had not before:
Compiler Error Message: BC30469: Reference to a non-shared member
requires an object reference.
The code: strLogonName = HttpContext.User.Identity.Name


add a "Current" inbetween:
HttpContext.Current.User.Identity.Name

Hans Kesting
Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Support | last post by:
Hello: I wrote a vb6 "client-side" ActiveX Component that will extract the user's network login. Now I want to be able to do some server-side work with this info, and it would be great if I could...
4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
3
by: Roy Souther | last post by:
Trying to get the unixODBC to work connecting to an IBM DB2 UDB V8.1. The DB2 server is running on Red Hat 8 and is tested and confirmed to be serving connections to Windows 98 clients using the...
0
by: Jerry Kogan | last post by:
Hello everybody, this is the problem I encountered with working with the client-side javascript from the .ASPX page, I believe that info will be exremely useful:...
2
by: Robert Wagner | last post by:
I've created a page using VS.NET and page validator controls. The client side validation works fine on IE, but does not even activate under "alternate" browsers like Mozilla, Opera, etc. Why is...
3
by: NWx | last post by:
Hi, I have a ASP.NET application using forms authentication Default page is default.aspx, and login page is login.aspx As I perform authentication in Login page, I want to update a log table...
5
by: Cichy | last post by:
Hello, I'm writing a Client-Server application using sockets (asynchronous). There is a Server (Master) which accepts incoming connections, and Client (Slave). Afetr establishing connections...
6
by: =?Utf-8?B?S2VsbHk=?= | last post by:
We just switched our web application from .NET 1.1 to 2. Once client can't login out of several that have been successful. They enter a correct user name and password, click the login button and...
2
by: nja2222 | last post by:
I would like to create a page for my clients to login and check for updates on their accounts. Then I would like to create a page where my employees can login and make updates, specifically new file...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.