www.webdeveloper.com
Results 1 to 5 of 5

Thread: Getting the username

  1. #1
    Join Date
    Jun 2012
    Posts
    58

    Getting the username

    I need to get the username from windows. This is the code that I have that is giving it to me

    Code:
        var username = Request.ServerVariables("LOGON_USER");
        var temp = new Array();
        temp = username.split('\\');
        username=temp(1);
    It returns domain/username. However when it gets to line 3 I get the following error:

    Microsoft JScript runtime error '800a01b6'

    Object doesn't support this property or method

    I need to get just the username. How do I do this?

    Thanks.

  2. #2
    Join Date
    Jul 2009
    Posts
    184
    It's possible that the returned domain/username isn't actually classified as a string.

    One thing you could try is this:

    Code:
    var username = new String(Request.ServerVariables("LOGON_USER"));

  3. #3
    Join Date
    Jun 2012
    Posts
    58
    Thanks for the reply. I tried it and it seems to have worked partially. Now I get an error on line 3:
    Code:
        var username = new String(Request.ServerVariables("LOGON_USER"));
        var tempS = username.split('\\');
        username=tempS(1);
    The error:
    Microsoft JScript runtime error '800a138a'

    Function expected

  4. #4
    Join Date
    Jul 2009
    Posts
    184
    I think you need square brackets if tempS is an array. The round brackets are what make it think you are calling a function.

  5. #5
    Join Date
    Jun 2012
    Posts
    58
    That was it. Thanks so much.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles