首页 > 解决方案 > Retrieve Username after IIS Authentication

问题描述

I have a basic site (HTML/JavaScript) which is using IIS authentication (Windows Authentication) to restrict access. IIS authentication setup

After a user logs on to the site I need to then display their userID.

How can I retrieve the logged in userID knowing the site being restricted is simply HTML and JavaScript.

标签: javascripthtmliiswindows-authentication

解决方案


你可以使用这个:

<script language="javascript">
   var username = '<%HttpContext.Current.User.Identity.Name %>';
</script>

另一个帖子里有和你类似的问题,你可以参考答案


推荐阅读