Class WebSession
Public session As Notessession
Public database As NotesDatabase
...
Sub return(URL As String)
If Left(URL, 1)<>"/" Then
URL = "/"+URL
End If
Print "Location: " + URL
End Sub
' insert functions and subroutines here
' escape function is the same
Function escape(strIn As String) As String
Dim strAllowed As String
Dim i As Integer
Dim strChar As String
Dim strReturn As String
...
escape = strReturn
End Function
' unescape function is the same
Function unescape(strIn As String) As String
Dim i As Integer
Dim strChar As String
Dim strReturn As String
...
unescape = strReturn
End Function
' getCookieValfunction is the same
Function getCookieVal(thisname As String) As String
Dim cookie As String
Dim prefix As String
...
getCookieVal = unescape(Mid$(cookie, begin+Len(prefix), ending - begin -Len(prefix)+1))
End Function
' the setCookie sub needs a small adjustment where the database path (dbpath) is calculated
Sub setCookie(compName As String, compValue As String, adjYear As Integer, adjHour As Integer)
Dim thistime As NotesDateTime
Dim gmttime As NotesDateTime
Dim gmtvar As Variant
Dim cooktime As String
Set thistime = New NotesDateTime("")
Call thistime.SetNow
If adjHour <> 0 Then
Call thistime.AdjustHour(adjHour)
End If
If adjYear <> 0 Then
Call thistime.AdjustYear(adjYear)
End If
Set gmttime = New NotesDateTime(Left$(thistime.GMTTime, Len(thistime.GMTTime)-4))
gmtvar = gmttime.LSLocalTime
cooktime = Format(gmtvar, "dddd")+ ", " + Format(gmtvar, "dd")+ "-" + Format(gmtvar, "mmm") + "-" + Format(gmtvar, "yyyy") +_
" " + Format(gmtvar, "hh:mm:ss") + " GMT"
compName = escape(compName)
compValue = escape(compValue)
Dim dbpath As String
dbpath = Strleft(Lcase(Me.document.Path_Info_Decoded(0)), ".nsf") + ".nsf"+ "/"
Print "Set-Cookie: " + compName + "=" + compValue + "; expires=" + cooktime + "; path=" + dbpath + ";"
End Sub
End Class