Display windows login details

Oct 10 2007 4:03 PM

I am trying to develop an in house leave application the uses AD to authenticate the users.

I would like to display the login details for the current user on a portion of the page so that there is no mistake when using the tool.

I am  using a web control that I have dragged on to a section of the master.page, but I am having difficulties getting it to work (still a newbie at this)

CODE on the WebControl:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Security.Principal;

public partial class UserControls_WebUserControl : System.Web.UI.UserControl
{

protected System.Web.UI.WebControls.Label lblInfo;
protected void Page_Load(object sender, EventArgs e)

{

if (Request.IsAuthenticated)
{
lblInfo.Text =
"<b>Current user: </b> " + Page.User.Identity.Name;
WindowsIdentity identity = (WindowsIdentity)Page.User.Identity;
}
}
}

All I need to be able to do is display on a web page is

Domain\username