dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: Can ASP be used to pick up a Computer name?

  1. #1
    Join Date
    Aug 2003
    Location
    Glasgow, Scotland
    Posts
    211

    Can ASP be used to pick up a Computer name?

    I'm not sure if this is possible...much less how to do it if it can be done!

    I'm writing an Intranet and we intend to use it for users to submit IT Support Requests, it would be very handy for us if 'something' could pick up the users computer name from their PC. (This is because computers are often on different sites and we can use PC Anywhere to access their machine). All too often the users have trouble finding their Computer name so it would be fantastic if the intranet could pick it up.....anyone know if this is possible?

    I don't want to keep it all in a database as PC's get formatted all the time and I'm not sure that people would keep a database up to date!

    Thanks for any help anyone can give.

  2. #2
    Join Date
    Dec 2004
    Location
    Eau Claire, WI
    Posts
    153
    What kind of network do the workstations run on? And what platform?

    I just accomplished this by changing some of the settings in IIS, but I believe you need to be on IIS 4 or higher, and the computers must be Win2k or higher..

    I will be at my office in about 45 minutes and will have the exact settings for you then..

    -Brad

  3. #3
    Join Date
    Aug 2003
    Location
    Glasgow, Scotland
    Posts
    211
    At the moment our network is Windows 2000 server, we have a mixture of XP and NT for the users. The intranet will be hosted on a separate server (running Windows 2000 server).

    Ultimately everyone will have XP (hopefully by the end of January!) so if you're aware of a way this can be done....even if I have to implement it later it really would be a brilliant help!

    Thanks!

  4. #4
    Join Date
    Dec 2004
    Location
    Eau Claire, WI
    Posts
    153
    It took me a great deal of time, and when I finally got it figured out, it was so simple..

    Here's the function I used:

    Function GetWorkstationName()
    strHostName = Request.ServerVariables("REMOTE_HOST")
    strUserName = Request.ServerVariables("REMOTE_USER")
    strUserName = Mid(strUserName, Instr(strUserName, "\") + 1, Len(strUserName))
    strDomainName = Left(Request.ServerVariables("REMOTE_USER"), Instr(Request.ServerVariables("REMOTE_USER"), "\") - 1)

    GetWorkstationName = strUserName
    End Function

    Now, this function requires a change of settings within IIS. I believe I had to inactivate Anonymous logins and Check the "Integrated Windows Authentication" box. It's been a while, so if that doesn't work we can compare IIS settings and come up with the solution for you..

    -Brad

  5. #5
    Join Date
    Jun 2004
    Location
    Kansas City, MO
    Posts
    1,607
    candelbc is correct on how to set up the settings.

    I also have my intranet set up this was as i do not require a log in
    because i can see who is trying to access the intranet by the users Request.ServerVariables("REMOTE_USER").

    Also Request.ServerVariables("REMOTE_USER") is not the computer name.

    Its the username that the user uses to log on to their computer.
    My computer name is larryfxp but Request.ServerVariables("REMOTE_USER") will give me larryf which is my NT username that i use to log on to my computer(I could be wrong but i believe this is how it is)

    One other thing, this may pop up a windows log in box when you access your site asking the user for their username and password.

    If you have issues with this, change the settings in
    Tools/Internet Options/Security/Local Intranet/Customer Level
    Scroll to the bottom and youll see User authentication.
    You have 4 options.
    You can choose either
    Automatic Logon only in intranet zone.
    Automatic logon with current username and password.

    TO force the user to log on choose
    Prompt for user name and password.

    You can not choose
    Anonymous logon as you will get an error Unauthorized:logon fialed dut to server configuration.
    This should be enough to do what you are looking for.

  6. #6
    Join Date
    Dec 2004
    Posts
    26
    How do these settings change/affect things:

    -Inactivate Anonymous logins
    -Check the "Integrated Windows Authentication" box

    I don't know if my company will allow these settings on our Intranet... what problems will this bring about if they do make these changes. We have other pages on the Intranet where users have to log in.

  7. #7
    Join Date
    Jun 2004
    Location
    Kansas City, MO
    Posts
    1,607
    well what your doing is by unchecking
    Inactivate Anonymous logins and
    checking
    Check the "Integrated Windows Authentication" box
    is not allowing just anyone to view the pages.
    They must be part of your network.
    When you do this you can capture the user who is logged on.

    Im not sure but i think you can set this setting per page.

    When you do this based on the settings in your browser,
    the user will either be prompted for their username and password.
    or they will be allowed access.

    If your unsure set up a test site and see how it effects things.
    You would most likely have to change the way your site works as you
    would not want your users to have to log on twice.

    On the other hand its nice because unless your a part of the net work
    you will not have access.

    Also what i do is, i have a table set up in the DB with username, name, dept, and access rights to each part of the page. I do not make
    users log on because they are either granted access by their username and password becasue either they belong to the network or do not belong.
    Then when the try to access a page that is access restricted.
    I do a db search on their username, which you can get by using
    Request.ServerVariables("REMOTE_USER")
    i then check to see if this user has access or not.

    This is alittle redundent because i keep a table of all the users.
    What i would like to do is use LDAP and hit active directory and
    get the users rights from their, but not set that up yet.

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