convert windows username to lower case & remove domain name

Author Message
vadread

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 11/21/2011
  • Status: offline
convert windows username to lower case & remove domain name Monday, November 21, 2011 5:50 AM (permalink)
0
Hi I am a little new to VBscript
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 windows 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. Appreciate anyone who can help....
username=Lcase(Replace(Request.ServerVariables("AUTH_USER"), "DM_MONTYNT\", ""))
<message edited by vadread on Monday, November 21, 2011 6:00 AM>
 
#1
    59cobalt

    • Total Posts : 981
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:convert windows username to lower case & remove domain name Monday, November 21, 2011 7:24 AM (permalink)
    0
    Try this:
    auth_user = Request.ServerVariables("AUTH_USER")
    username = LCase(Mid(auth_user, InStr(auth_user, "\")+1))

     
    #2
      vadread

      • Total Posts : 4
      • Scores: 0
      • Reward points : 0
      • Joined: 11/21/2011
      • Status: offline
      Re:convert windows username to lower case & remove domain name Monday, November 21, 2011 7:36 AM (permalink)
      0
      thanks
      <message edited by vadread on Monday, November 21, 2011 8:46 AM>
       
      #3
        59cobalt

        • Total Posts : 981
        • Scores: 91
        • Reward points : 0
        • Joined: 7/17/2011
        • Status: offline
        Re:convert windows username to lower case & remove domain name Monday, November 21, 2011 8:49 AM (permalink)
        0
        You're welcome.
         
        #4
          vadread

          • Total Posts : 4
          • Scores: 0
          • Reward points : 0
          • Joined: 11/21/2011
          • Status: offline
          Re:convert windows username to lower case & remove domain name Monday, November 21, 2011 9:21 AM (permalink)
          0
          This is what I did:
          <html>
          <HEAD> <meta HTTP-EQUIV="REFRESH" content="1; url=http://ykvmgs15:8080/arsys/servlet/ViewFormServlet?form=WS%3AOpenRequests&server=ykvmgs12&username=<%auth_user = Request.ServerVariables("AUTH_USER") username = LCase(Mid(auth_user, InStr(auth_user, "\")+1))%>"></HEAD>
          <body>
          </body>
          </html>
          this is what I got:
           
          Technical Information (for support personnel)
          • Error Type:
            Microsoft VBScript compilation (0x800A0401)
            Expected end of statement
            /myweb/test2.asp, line 2, column 49
            [
           
           
          #5
            59cobalt

            • Total Posts : 981
            • Scores: 91
            • Reward points : 0
            • Joined: 7/17/2011
            • Status: offline
            Re:convert windows username to lower case & remove domain name Tuesday, November 22, 2011 10:53 AM (permalink)
            0
            Unless the forum software mangled your code: I don't think this will work as you seem to think. I'm not an ASP guy, but VBScript statements are line-oriented, so you can't put two statements in the same line without at least putting a separator (":") between them. Try it like this:
            <html>
            <HEAD><meta HTTP-EQUIV="REFRESH" content="1; url=http://ykvmgs15:8080/arsys/servlet/ViewFormServlet?form=WS%3AOpenRequests&server=ykvmgs12&username=<%
            auth_user = Request.ServerVariables("AUTH_USER")
            username = LCase(Mid(auth_user, InStr(auth_user, "\")+1))
            %>"></HEAD>
            <body>
            </body>
            </html>

             
            #6

              Online Bookmarks Sharing: Share/Bookmark

              Jump to:

              Current active users

              There are 0 members and 1 guests.

              Icon Legend and Permission

              • New Messages
              • No New Messages
              • Hot Topic w/ New Messages
              • Hot Topic w/o New Messages
              • Locked w/ New Messages
              • Locked w/o New Messages
              • Read Message
              • Post New Thread
              • Reply to message
              • Post New Poll
              • Submit Vote
              • Post reward post
              • Delete my own posts
              • Delete my own threads
              • Rate post

              2000-2012 ASPPlayground.NET Forum Version 3.9