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

Discussion in 'ASP .Net' started by Ryan, Jan 19, 2006.

  1. Ryan

    Ryan Guest

    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
     
    Ryan, Jan 19, 2006
    #1
    1. Advertisements

  2. Ryan

    Ryan Guest

    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.
     
    Ryan, Jan 19, 2006
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.