Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get the Windows logon name with site running asp.net forms authentication?

I have a website with a large user base configured with asp.net 2.0 forms authentication. Before the user logs in via forms authentication is it possible to retrieve the windows login name/user account name on the machine they are using?

Many thanks

like image 700
Shigg Avatar asked Jan 07 '10 11:01

Shigg


People also ask

How many types of authentication ASP.NET supports Windows authentication?

ASP.NET supports three types of authentication: Windows, Passport, and forms.

What is form authentication in ASP.NET with example?

Forms authentication enables user and password validation for Web applications that do not require Windows authentication. With forms authentication, user information is stored in an external data source, such as a Membership database, or in the configuration file for an application.


1 Answers

It certainly is possible--by adding another web application to your system. Here's roughly how I have done it:

Your primary web app uses Forms authentication. On the forms login page, any user that is determined to be on the local LAN (check IP address), redirect them to another app that uses Windows authentication. In this second app, you can determine the user (assuming the browser is configured to send credentials automatically to the zone in which your app resides), then set a cookie which your first app can read, and redirect the user back to the original app.

This does work.

like image 186
TheObjectGuy Avatar answered Nov 15 '22 06:11

TheObjectGuy