ServerVariables("LOGON_USER") reports a length greater than the characters displayed

R

Ryan

I am trying to figure out why


I am trying to use the result of Request.ServerVariables("LOGON_USER")
in a query in my aspx application. I want to use the server variable.
When I check the length of the string that this method returns
(len(Request.ServerVariables("LOGON_USER")) I get a number that is one
greater than the the number of characters that are displaying, which of
course causes a problem. Does anyone know why this is and how to fix
the problem. My only guess is that it is counting the slash even
though it does not display it...

e.g.

LOGIN: MyDomain\Ryan
Request.ServerVariables("LOGON_USER") = MyDomainRyan
len(Request.ServerVariables("LOGON_USER") = 13
len("MyDomainRyan") = 12

Thanks,
Ryan
 
R

Ryan

Ok, so I found the answer to my own question. In case anyone is
wondering I feel like I should explain what went wrong, though I am
reluctant to admit it...

I was viewing the server variable by outputting the text to a
javascript alert box. And of course, when javascript saw the special
character "\" it treated it as such and hence what displayed was
different than the actual variable value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top