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.nameis 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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -