+ Post New Thread
Results 1 to 7 of 7
Home Access Plus+ Thread, How to grab the username from HAP logon to use in my own code? in Projects:; Hi all, When running Version 5.6 of HAP we also had some classic .asp pages that pulled specific info from ...
  1. #1

    Join Date
    Nov 2007
    Location
    Manchester
    Posts
    206
    Thank Post
    2
    Thanked 13 Times in 7 Posts
    Rep Power
    16

    How to grab the username from HAP logon to use in my own code?

    Hi all,

    When running Version 5.6 of HAP we also had some classic .asp pages that pulled specific info from a database for each user which worked by using the following code:

    <%
    ' CAPTURE STUDENT USERNAME
    Dim objNet
    Set objNet = CreateObject("WScript.NetWork")
    session("user") = objNet.UserName
    response.write session("user")
    %>

    With the new install, presumably because the version 9 install on IIS7 now uses AppPoolIdentity, no matter who logs in, the user that this code returns is 'HAP'.

    Is there anyway of grabbing the username that is entered when someone logs in now?

    Many thanks in advance,

    Adrian

  2. #2
    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,561
    Thank Post
    38
    Thanked 507 Times in 437 Posts
    Rep Power
    114
    C#

    Code:
    User.Identity.Name
    Is what you are after

  3. #3

    Join Date
    Nov 2007
    Location
    Manchester
    Posts
    206
    Thank Post
    2
    Thanked 13 Times in 7 Posts
    Rep Power
    16
    Thanks Nick, but how do I use that in context of the code I gave? I've had a Google and it seems to asp.net rather than classic and I need to do it from classic.

    Sorry for being thick, but this isn't my forte!... (not sure what is really!)

  4. #4
    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,561
    Thank Post
    38
    Thanked 507 Times in 437 Posts
    Rep Power
    114
    Ah, I don't think you can from classic, sorry to say. It's a ASP.net thing

  5. #5

    Join Date
    Nov 2007
    Location
    Manchester
    Posts
    206
    Thank Post
    2
    Thanked 13 Times in 7 Posts
    Rep Power
    16
    No worries Nick. I've just moved the classic ASP stuff to a new virtual directory and am using basic auth on that instead.

  6. #6
    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,561
    Thank Post
    38
    Thanked 507 Times in 437 Posts
    Rep Power
    114
    Ah ok, that works too. You could set HAP+ up to use Windows Authentication as well, which v9 supports, couple of things need to change to do that, if you want it

  7. #7

    Join Date
    Nov 2007
    Location
    Manchester
    Posts
    206
    Thank Post
    2
    Thanked 13 Times in 7 Posts
    Rep Power
    16
    That would be useful to know for future reference if I try to do any more work on the classic asp stuff. (What I really need is a year of doing sod all but learning asp.net instead but I don't think thats going to happen soon!)

SHARE:
+ Post New Thread

Similar Threads

  1. ESXi - when to pull the plug from the physical server?
    By Ignatius in forum Thin Client and Virtual Machines
    Replies: 10
    Last Post: 23rd November 2012, 02:57 PM
  2. Replies: 1
    Last Post: 22nd February 2012, 12:10 PM
  3. Replies: 2
    Last Post: 22nd May 2011, 09:43 PM
  4. Replies: 44
    Last Post: 1st June 2010, 06:11 PM
  5. Replies: 2
    Last Post: 8th March 2008, 02:18 PM

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
  •