简体   繁体   中英

C# - Authenticate AD user on public page

I want to display the start page of my web application in one way if the visiting user is authenticated in the AD and another way if the user is not.

I am able to distinguish users by checking their username using this: HttpContext.Current.User.Identity.Name

However, this only works after the user has tried to access a secured page and I want to know this when a user visist the public start page. Any ideas of how this can be done?

If you don't have Authentication you can't know which user is it. So I guess you can set cookie/localStorage for the next time he will get to the page.

OR

What I think will be preferable when using AD, you can provide sub domain for those users, so each time someone is coming from this sub domain you will know he is AD user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM