Author: mikezx10 | Posted on: 12/21/2009 8:32:52 AM | Views : 1107

I had the below code and it was workign fine locally when i was debuging with the local iis integrated with VS2008.  But after puting the code on the Web server the user name ends up being "NETWORK SERVICE"  how can i make this work when deployed?



using System.Web.UI.WebControls;
using System.Security.Principal;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        WindowsIdentity id = WindowsIdentity.GetCurrent();
        string[] s = id.Name.Split('\\');
 
        // We are saving in a type the string array s will hold 0=domian, 1=userName
        //currentUser.UserDomain = s[0];
  ...

Go to the complete details ...