Attempt at creating the infamous WEB LOGOFF button...

Discussion in 'ASP .Net Security' started by dsl, Oct 19, 2003.

  1. dsl

    dsl Guest

    I'm a newbie (at this stuff anyway) - working with WIN2K server and
    Sharepoint Team Services, working at creating an intranet... and looking for
    a way to allow users to "log off" via a log off button for shared use of
    individual computers throughout the day...

    In browsing through various web resources, I came across an article for
    creating a "browser.ocx" file, and using it with a little code to create the
    log off effect.

    Well, I created the .OCX per the instructions, registered it with regsrv32,
    added the test1.htm page to the root of my web, and tested it.

    I got the logoff button to appear ;-) ...(hey I'll take what I can
    get...)... but the report of errors on the page. Before hitting the button,
    an error:

    "Automation server can't create object"

    ....and after hitting the button,

    "'obj1' is null or not an object"

    Any thoughts on this? For the sake of having any chance to answer this, I'm
    splicing in the guts of the post I used below.
    I currently have the web set for basic authentication, NO anonymous access,
    but originally had it set with both basic AND windows authentication. Still
    not sure where I'm going with that yet.

    Any thoughts greatly appreciated...


    Original message:
    =========================================

    From: "Joseph Geretz" <>
    Date: Sun, 9 Mar 2003 23:29:13 -0500

    Hi Luc,

    Thanks for the tip.
    This actually works. It's not even that big a deal to code.

    --------------
    Option Explicit

    Const END_BROWSER_SESSION = 42

    Private Declare Function InternetSetOption Lib "wininet.dll" _
    Alias "InternetSetOptionA" _
    (ByVal hInternet As Long, _
    ByVal lOption As Long, _
    ByRef sBuffer As Any, _
    ByVal lBufferLength As Long) _
    As Integer

    Public Function FlushCredentials() As Integer

    FlushCredentials = InternetSetOption(0, END_BROWSER_SESSION, 0, 0)

    End Function

    --------------
    <script language=javascript>
    <!--
    var logoff = new ActiveXObject("browser.logoff");
    var x = logoff.FlushCredentials();
    //-->
    </script>
    --------------

    However, I'm not thrilled about having to rely on a client hosted ActiveX.
    Is it possible to do this by working directly with the browser DOM via
    javascript?

    Thanks,

    - Joe Geretz -

    Next message: [MSFT]Allen: "RE: running app under custom account"
    Previous message: Mike Bourne: "128 Bit encrytin problem with ASP.NET (VB)"
    In reply to: Luc Kumps: "Re: How to provide Log Off for a Web Application?"
    Next in thread: Luc Kumps: "Re: How to provide Log Off for a Web
    Application?"
     
    dsl, Oct 19, 2003
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.