We have a pure html page running in our IIS, and we would like to know what logged-in users are accessing the page. By "logged-in" users I mean a user that looged on to our intranet in their Windows machine.
It seems that I can't retrieve this information with javascript or html, so I was considering using .net
for this, something like the following:
System.Security.Principal.WindowsIdentity.GetCurrent().Name
Is it possible to add server-side code to this HTML page without having to go to Visual Studio
to create a solution or project?
I just don't want to have to "convert" this .HTML
into an .ASPX
just for one line of code. These html pages have tons of javascript charts, and I know something will break if I open it in VS.
No, you can't run server code in HTML.
You can do the following:
<%@ 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>