asp.net mvc - @HttpContext.Current.User.Identity.Name not showing backslash -
super simple. issues find people getting null. obvi fixed. backslash???!!
params.me = '@httpcontext.current.user.identity.name';
this returns
"domainusername" <- browser "domain\\username" <- debugging
what expect is
"domain\username" <- browser
any ideas?
based on comments using following code show user name:
alert('@httpcontext.current.user.identity.name');
@httpcontext.current.user.identity.name
is string can contain "\" backslash character. character considered escape character in javascript in c# well. need escape "\" character in string before passing javascript that:
alert('@httpcontext.current.user.identity.name.replace("\\", "\\\\")')
Comments
Post a Comment