Get the computer user name in a web application

2019-07-19 15:28发布

I have a web application where forms authentication is used. The user names are the same that the ones used by the users in their computers, so they want the web app to be able to detect that user name so the app can log it the user automatically.

How can it be done? I mean, if I set the authentication mode to "Form" do I still get those credentials from IIS?

I know this can be done in several better ways than this, but I am interested in this particular way. As it is a small web app in an intranet with a few users doesn't worth it a big architectural change. If it's possible, happy days, otherwise it will have to wait.

Cheers.

2条回答
放荡不羁爱自由
2楼-- · 2019-07-19 16:07

That cannot be done with Forms Authentication. Without prompting the client for credentials, there is no way to retrieve that information from the client's machine.

查看更多
倾城 Initia
3楼-- · 2019-07-19 16:08

Windows auth cannot coexists with Forms auth, but it can coexists with Anonymous auth.

More info here: Windows authentication is not challenging browsers out of the domain

查看更多
登录 后发表回答