New Improved Version 1.1 of WebSession Class

Following Friday's post and the subsequent responses I decided to update my WebSession code to address the problem and make the Domino Directory a global object. In doing so I realised it's about time I made a new version of that class available for download.

When I originally made it available it was as part of the WQO Calendar thingy, which contained numerous other techniques and code sources. It worried me to think that the WebSession class itself could be over-looked so easily and its usefulness as a standalone piece of code could be neglected. It should be a self-contained download of its own.

So, I've created a new bare-bones copy of the database that contains nothing but the class and a demo of its use. It's in the sandbox and you can download it directly here.

It's been nice to see adoption of the concept from others in the community and part of what's changed in this version is based on suggestions I've received. If you're yet to look at the class or work out what use it is then you really should take a quick peak. This one class saves me so much time on a daily basis and has become an integral part of every database I now create.


  1. Just a question: doesn't your FQDN property need some field on the Form to work like that? The CGI Variables are filled in agent context documents (caling an agent), but not when you are using them to serve docs in WQO Agents. That was at least my finding, when I tried to use a websesison class in such agents (template system): I had to add fields with the CGI Names to the webform (which otherwise had only one field visible to return the generated html).

    • avatar
    • Jake Howlett
    • Mon 11 Feb 2008 08:40 AM

    Good point Jan. I'd assumed you'd all work that out, but I forgot to add the "CommonFields" subform, which contains all these CGI fields, and which I add to all forms.

    I've updated the download database to include this subform now. Thanks for the pointer!

    • avatar
    • Jan Schulz
    • Mon 11 Feb 2008 09:08 AM


  2. Default is set to No Access. Well, this puppy won't work in Notes 5 anyway, so not a big deal (if you have your own server).

    • avatar
    • Jake Howlett
    • Tue 12 Feb 2008 04:23 AM

    Woops. Updated now. Thanks for letting me know Fabian.

  3. @Fabian: R5 hit EOL in 2004 and EOS in 2005. The current version is Domino 8, with Domino 8.5 to be released later this year. I wouldn't spend too much time looking for new and exciting code written for R5 here -- or anywhere else.

  4. Stan, you mis-read my posting big time, if you really thought, I was asking to make the download R5 compatible. :-)

    I was just referring to the most simple, no-brainer method of opening a database you don't have access to: Full access administration. Not available in Notes 5 (or before).

    • avatar
    • Alastair Grant
    • Sat 23 Feb 2008 02:11 PM

    Hi Jake,

    Let Me.BaseURL = "http"+Replace(Me.document.HTTPS(0), "ON", "s")+"://"+Me.FQDN+"/"+Me.path

    The HTTPS field will default to 'OFF' so you'll need:

    If Me.document.HTTPS(0)="ON" Then

    Let Me.BaseURL = "https"+"://"+Me.FQDN+"/"+Me.path


    Let Me.BaseURL = "http://"+Me.FQDN+"/"+Me.path

    End If

    • avatar
    • Jake Howlett
    • Mon 25 Feb 2008 03:49 AM

    Hi Alistair. Good point! Thanks for that. I've fixed the download copy by double Replacing:

    Replace(Replace("ON","s"), "OFF","")

    I much prefer less lines of code over "readability" 'o)


  5. Thank you! This is very useful. Great code.

  6. Jake, I've been using your web session class for ages. I love it.

    I have made a couple of changes though that have improved performance. One was in the area of URL Encoding / Decoding. LS Is much slower than the native java methods for this, so I used LS2J to wrap the proper methods and you get a huge performance gain.

    Public Function urlEncode(s As String) As String

    Set Me.jses=New JAVASESSION()

    Set Me.jclass=jses.GetClass("java/net/URLEncoder")

    Set Me.jstring=jclass.CreateObject()

    urlEncode = Me.jstring.encode(s,"UTF-8")

    End Function

    Public Function urlDecode(s As String) As String

    Set Me.jses=New JAVASESSION()

    Set Me.jclass=jses.GetClass("java/net/URLDecoder")

    Set Me.jstring=jclass.CreateObject()

    urlDecode = Me.jstring.decode(s,"UTF-8")

    End Function

    Similarly, if you wanted to use Base64 Decoding, LS is very slow for this but there are freely available java libraries that improve performance by a couple of orders of magnitude. That implementation is a bit more long winded so I'll leave it off here.

Your Comments


About This Page

Written by Jake Howlett on Mon 11 Feb 2008

Share This Page

# ( ) '


The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social

About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content