Login | |
|
 |
Re: Convert Jscript to Vbscript - 5/7/2005 5:35:46 AM
|
|
 |
|
| |
JohnnyGeek
Posts: 1
Score: 0
Joined: 5/6/2005
From:
Status: offline
|
I feel your pain... I have connected with many a CAS system, and this is the exact same script I was given to use - and it drove me nuts. Couple of things - First, I noticed your script uses "serviceValidate?service=". That may not be wrong - just thought I'd mention that every one I've ever connected to, it was "validate?service=". Check with the UNIX admin wherever you're trying to connect if you have issues. Second, I noticed your "MyServer" service is not secure (https). I've had nothing but issues trying to connect without being secured. You'll notice there is a line in my script directly under the Set Server.CreateObject line, defining a "setOption 2" variable for the "MSXML2.ServerXMLHTTP.4.0" object. This commented line (when uncommented) tells the server to ignore any SSL related errors. Good luck. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Dim CAS_Server, MyServer, uid, ticket CAS_Server = "https://secure.kau.se:443/" MyServer = "http://se-sol1-bl01-04/Approveit/" MyLogon = "gui/inv_gui_login_karlstad1.asp" uid = Session.Contents("Netid") ticket = Request.QueryString("ticket") 'See if already logged on If uid = "" Then 'Check for ticket returned by CAS redirect If ticket = "" Then 'There is no ticket 'No session, no ticket, Redirect to CAS Logon page Response.Redirect(CAS_Server & "login?service=" & MyServer & MyLogon) Else 'There is a ticket, check for validity 'Back from CAS, validate ticket and get userid Dim http, url, resp, greeting url = CAS_Server & "serviceValidate?service=" & MyServer & "&ticket=" & ticket Set http = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0") 'http.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS http.open "GET", url, false http.send resp = Split(http.responseText,vbLf) 'Lines become array members Set http = Nothing 'Don't leave the object open - you're done with it. If resp(0) = "yes" 'Logon succesful greeting = resp(1) 'get userid for message Session.Contents("Netid") = resp(1) 'Save for subsiquent calls Else 'Logon unsuccessful - Optional Response.write("Logon Failed") 'Optional End If 'End if resp(0) = yes End If 'End if check for ticket End If 'End if check for already logged on %>
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|