how can i allow only one visitor to visit the page
<p>I have a page call "A" Asp.Net and i want to allow only one user to access the page. If nobody accessing the page then any user are allowed to access the page
            Without using database how can i do it.
            I am trying to use page load of c# and window onbeforeunload event of javascript but didnt get it.  </p>

<pre><code>&lt;script type="text/javascript" language="JavaScript"&gt;
        var hidViewstate;

        window.onload = body_Load;
        window.onbeforeunload = WindowCloseHanlder;

        function body_Load()
        {
            hidViewstate = document.getElementById('&lt;%=hidViewstate.ClientID %&gt;');
        }

        function WindowCloseHanlder()
        {
            hidViewstate.value = parseFloat(hidViewstate.value - 1);
        }

    &lt;/script&gt;

&lt;div&gt;
        &lt;asp:Label ID="lblText" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
        &lt;asp:HiddenField ID="hidViewstate" runat="server" /&gt;
    &lt;/div&gt;

protected void Page_Load(object sender, EventArgs e)
    {
        hidViewstate.Value = "1";

        if(Convert.ToInt32(hidViewstate.Value) == 1)
        {
            lblText.Text = "Welcome First User";
        }
        else
        {       
            lblText.Text = "Visiting on this page is not allowed because user is already login.";

        }

    }
</code></pre>
