我们有一个在 IIS 中运行的纯 html 页面,我们想知道哪些登录用户正在访问该页面。我所说的“登录”用户是指在他们的 Windows 机器上登录到我们内部网的用户。
似乎我无法使用 javascript 或 html 检索此信息,因此我正在考虑.net
为此使用,如下所示:
System.Security.Principal.WindowsIdentity.GetCurrent().Name
是否可以将服务器端代码添加到此 HTML 页面而无需Visual Studio
创建解决方案或项目?
我只是不想将其“转换”.HTML
为.ASPX
仅用于一行代码的代码。这些 html 页面有大量的 javascript 图表,我知道如果我在 VS 中打开它会出错。
不,您不能在 HTML 中运行服务器代码。
您可以执行以下操作:
<%@ Page language="c#" %>
<script language="CS" runat="server">
void Page_Load(object sender, System.EventArgs e)
{
Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
}
</script>
<iframe src="currentcontext.aspx"></iframe>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句