Convert auth_user to Lower Case & Remove Domain Name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • miamibmw
    New Member
    • Nov 2011
    • 2

    Convert auth_user to Lower Case & Remove Domain Name

    Can anyone help me. I have a small set of code that gets the windows user name & sets it into a URL. The URL then passes that to a browser login & logs my users in (this already works). The small problem I am having is I need to convert the username to Lower case & strip out the doamin name, so that I end up with just the raw lowercase indows username. This is what I have so far. I am sure its just my syntax as I have done this before but it was a long time ago.

    Code:
    username=<%Response.Write(Request.ServerVariables("AUTH_USER"))%>">
    Last edited by NeoPa; Nov 21 '11, 06:52 PM.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    convert auth_user to lower case &amp; remove domain name

    LCASE() will convert a string to lower case.
    MID() will pull a substring out of a string.
    INSTR() will find the index of the backslash character in the string.

    Comment

    • miamibmw
      New Member
      • Nov 2011
      • 2

      #3
      yeah its syntax that is throwing me....I need to see the actual snippet & pop it in

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Give it a shot and post back what you get.

        Comment

        • jhardman
          Recognized Expert Specialist
          • Jan 2007
          • 3405

          #5
          The other thing that's throwing you off is the response
          .Write. That prints the text to the screen, that doesn't help you for a variable assignment. Take out the response.write and the code delimiters, you are already in code so those are no good
          Code:
          username=request.servervariables("auth_user")
          rabbit is right, you then need a combination of lcase() and something to whittle the string down. I personally would use instr() (to find the position of the @ or \) and right(str, n) (Gives you the right-most n characters of the string).

          Jared

          Comment

          Working...