For the latest information regarding technology support for the Coronavirus situation, please visit UCI TechPrep.

WebAuth ASP Script

	' Uses free AspTear
	' Download AspTear to install on IIS server here:
	' Already installed on IST-Prod6.nacs

	' AspTear constants
	Const Request_POST = 1
	Const Request_GET = 2
	' Variables used in this routine:
	Dim strRetVal, strUrl
	Dim strIDCookieVal
	Dim arrRetVal, arrItem, arrGetVals
	Dim strUciNetId, strUciNetIdAge, strUciNetICreated, strUciNetIdIdle, strUciNetIdCampus, strUciNetIdAuthFail
	Dim strIDCookie
	Dim objTear
	' Create the AspTear object for getting info from
	Set objTear = Server.CreateObject("SOFTWING.ASPtear")

	' Get the login cookie if it's there
	strIDCookieVal = request.Cookies("ucinetid_auth")
	' Setup the URL to "check" the login
	strUrl = "" & strIDCookieVal
	' Actually go to the login page and get the results back
	strRetVal = objTear.Retrieve(strUrl, Request_POST, "", "", "")
	' Testing output for debugging
	'Response.Write("strRetVal=" & strRetVal & "<br />")
	' Parse thru the return string to determine the results
	' The return string is a pair value string with line feed separators
	arrRetVal = Split(strRetVal, vbLf)
	For Each arrItem in arrRetVal
		If (arrItem <> "") Then
			arrGETVals = Split(arrItem, Chr(61))
			If arrGetVals(0) = "ucinetid" Then
				strUciNetId = arrGetVals(1)
			ElseIf arrGetVals(0) = "age_in_seconds" Then
				strUciNetIdAge = arrGetVals(1)
			ElseIf arrGetVals(0) = "time_created" Then
				strUciNetICreated = arrGetVals(1)
			ElseIf arrGetVals(0) = "max_idle_time" Then
				strUciNetIdIdle = arrGetVals(1)
			ElseIf arrGetVals(0) = "campus_id" Then
				strUciNetIdCampus = arrGetVals(1)
			ElseIf arrGetVals(0) = "auth_fail" Then
				strUciNetIdAuthFail = arrGetVals(1)
			End If
		End If
	' If no UCInetID is returned, then NOT logged in, Make em.
	If (strUciNetId = "") Then
		' This sends them to the NACS login page, more secure than using your own
		' Falls thru to page below if login was successful
		' Or add your own redirect below to send them to the page of your choice
	End If
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>webauth test</title>
<h2>Congratulations, you are logged in</h2>
<a href="">Click here to logout</a>
<p>Here is the information about you that I got from Login:</p>
	<li> UCInetID: <strong><%= strUciNetId %></strong> </li>
	<li> Age of your Login: <strong><%= strUciNetIdAge %></strong> </li>
	<li> Time you logged in: <strong><%= strUciNetICreated %></strong> </li>
	<li> Time you've been idle: <strong><%= strUciNetIdIdle %></strong> </li>
	<li> Your Campus ID: <strong><%= strUciNetIdCampus %></strong> </li>


Scroll Up