Can anyone tell me why this happens?...
I have this class
That i call in any form like this:
But the lblUsername.text (label) returns "".
I'am a newbie in C#, so fell welcome to help me ;P
PS. Yes i have inclued in the web.config the authentication Windows mode and config the IIS ( works ok since the not autorized users got a error page and the autorized user can acess the page )
I have this class
Code:
using System;
using System.Security;
using System.Security.Principal;
public class Username : System.Web.HttpApplication
{
public Username()
{
strUserName = User.Identity.Name.ToString();
}
static public string strUserName = "";
}
That i call in any form like this:
Code:
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblUserName;
private void Page_Load(object sender, System.EventArgs e)
{
string strUserName = Username.strUserName;
lblUserName.Text=strUserName;
}
}
But the lblUsername.text (label) returns "".
I'am a newbie in C#, so fell welcome to help me ;P
PS. Yes i have inclued in the web.config the authentication Windows mode and config the IIS ( works ok since the not autorized users got a error page and the autorized user can acess the page )