User information in the web request

  • Thread starter Thread starter Vadym Stetsyak
  • Start date Start date
V

Vadym Stetsyak

Hi there!
Is it possible to retieve user nt name from the web request? This question
arose while thinking about authentication system implementation in the
asp.net.

I want to make authentication process transparent for the user. E.g. if the
user is logged on the domain or is a member of the domain then perform
authentication autimatically - as a result user won't experience any login
windows, otherwise web-app will provide the form similar the IIS one for
authentication.

Can this be done from the web application?

TIA
 
You can tell who the user is once they are logged into the app, but you will
get IUSR_ComputerName or NetworkSystem prior to this point, as web apps are
anon by default.

There are ways to set up IE on an Intranet to avoid the login. An even
better option is issuing user certs, as the user can work from any computer
he has a cert without having to worry about login.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Thanks for the answer, I know about these ways, just wondered if it can be
completed in the other way
 
Hi Vadym,

If you use windows authentication and deny anonymous access:
In web.config
<authentication mode="Windows" />
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>

Then you can use
Context.User.Identity.Name

to get Domain/userID.

And use

Context.User.IsInRole(strRole)

to perform role checking.

HTH

Elton Wang
(e-mail address removed)
 
Back
Top