AtomicChip
Programmer
I'm developing an intranet site, and I'm looking into ways of getting the user's name without requiring them to log in with their Windows username and password. The way that I'm doing this right now is:
Web.Config file:
<configuration>
<system.web>
<authentication mode="Windows" />
</system.web>
</configuration>
index.aspx file:
<%@ Page Language="c#" %>
<%@ Import Namespace="System.Security.Principal" %>
<script runat="server">
private void Page_Load(System.Object sender, System.EventArgs e)
{
WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
Response.Write (wp.Identity.Name);
}
</script>
<body>
This is pulling the machine name, but I'm trying to get the user name. Am I close here, or am I barking up the wrong tree? Any help would be definitely appreciated. -----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
Web.Config file:
<configuration>
<system.web>
<authentication mode="Windows" />
</system.web>
</configuration>
index.aspx file:
<%@ Page Language="c#" %>
<%@ Import Namespace="System.Security.Principal" %>
<script runat="server">
private void Page_Load(System.Object sender, System.EventArgs e)
{
WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
Response.Write (wp.Identity.Name);
}
</script>
<body>
This is pulling the machine name, but I'm trying to get the user name. Am I close here, or am I barking up the wrong tree? Any help would be definitely appreciated. -----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy