#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0

    ASP / VBScript - AD Email


    Hello everyone,

    I've been referencing DevShed for a while, but I've finally stepped up to the pitcher's mound (created an account) to see what kind of swings I'll get.

    I'm attempting to create a page on our Intranet that will be used as an SSO portal for Bloomfire. I already have the HTML/ASP code that will request a session key from Bloomfire using the user's email address and our apikey. I then use the response from that server to append the session key to the end of a URL redirecting the user to the Bloomfire site, and they are logged in as if they entered their username and password. I have no issues with this.

    I also have a Server-Side VBScript that grabs the logged on user's Windows Common Name, and searches AD for their email. This script is fully functioning by itself.

    My question is how to get the two to intermingle. I want the VBS to find the user's email address and then pass it to the ASP so I can have the user click a button to send their email and our api key to Bloomfire.

    Any ideas?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0

    More Info


    Hey all,

    I realized I didn't really provide much to go on. The VBScript is as follows:

    Set objSysInfo = CreateObject("ADSystemInfo")
    userName = objSysInfo.UserName

    Set objUser = GetObject("LDAP://" & userName)
    MsgBox objUser.mail

    Which I can run, or enclose as a function and call from the same file. I want to pass objUser.mail to an ASP file which creates the GUI for the page, and uses AJAX to send an XMLHttpRequest object with the email and apikey to Bloomfire, and read the session key from the response. I then simply append that key to the end of a URL (with ?session_key=xxxx) and redirect the user.
  4. #3
  5. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,431
    Rep Power
    4539
    Are you using classic asp (.asp files) or asp.NET (.aspx files). If asp.NET I can move this to the NET forum, this forum is mostly classic asp.

    In classic asp probably the easiest way to use both scripts would be to wrap the vbs in a COM wrapper.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0
    Doug,

    Thanks for the response. The code is .ASP classic. I attempted scouring Google to find how to 'wrap' my .vbs code to make it work as well, but I couldn't. I ended up using a simple .vbs script to create a table with all of our users' email addresses and Windows usernames. Then I grabbed their usernames with a WScript.Network object, and compared them in the table to find the email address. The rest was already done, just a request with email and apikey to BF and pull the session key from the response, append to URL and redirect.

    The Bloomfire API is pretty cool too, because if a user appears on my Excel sheet, and doesn't have an account in Bloomfire the API allows me to automatically create the account with a request object, and the response contains the new username and password along with the session key.

    Thanks for the assistance, now I just have to figure out how to mark my ActiveX Control as safe for scripting... MSDN here I come!
  8. #5
  9. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,431
    Rep Power
    4539
    I'm glad you got it sorted. What I meant was to use some other programming language to encapsulate the vbscript functionality in a .dll that could subsequently be instantiated by your asp code.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    ASP call to Bloomfire


    Hi Markhjr,

    I want to get Bloomfire session key using ASP classic code, can you please share the code that request a session key from Bloomfire using the user's email address and our apikey and how did you append the session key to the end of a URL redirecting the user to the Bloomfire site?

    Thanks in Advance.

IMN logo majestic logo threadwatch logo seochat tools logo