Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 29, 2012 06:49 AM by Matt99
Member
4 Points
45 Posts
Apr 29, 2012 06:18 AM|LINK
Hi,
Is it possible to strip out the Domain name from User.Identity.Name so that it would display just the username? For example to show Username instead of Domain\Username.
Here is the code that I am trying to strip out the domain name from:
protected void CallsManagementDS_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@CurrentUser"].Value = this.User.Identity.Name;
}
thanks
Apr 29, 2012 06:49 AM|LINK
ok
I found out how to do it.
e.Command.Parameters["@CurrentUser"].Value = Request.LogonUserIdentity.Name.Substring(Request.LogonUserIdentity.Name.LastIndexOf(@"\") + 1);
Matt99
Member
4 Points
45 Posts
User.Identity.Name without the domain name?
Apr 29, 2012 06:18 AM|LINK
Hi,
Is it possible to strip out the Domain name from User.Identity.Name so that it would display just the username? For example to show Username instead of Domain\Username.
Here is the code that I am trying to strip out the domain name from:
protected void CallsManagementDS_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@CurrentUser"].Value = this.User.Identity.Name;
}
thanks
Matt99
Member
4 Points
45 Posts
Re: User.Identity.Name without the domain name?
Apr 29, 2012 06:49 AM|LINK
ok
I found out how to do it.
e.Command.Parameters["@CurrentUser"].Value = Request.LogonUserIdentity.Name.Substring(Request.LogonUserIdentity.Name.LastIndexOf(@"\") + 1);