|
| Re: How to make a web site be single access?? |
 |
Wed, 2 Apr 2008 17:11:56 +0000 |
In theory this is posible to do.
You could use the Global.asax file, for example:PublicClass Global_asax
Inherits System.Web.HttpApplicationSub Application_Start(ByVal sender AsObject,
ByVal e As EventArgs)
' Fires when the application is started
If IsNothing(Application("oUsers")) Then
Application("oUsers") = "0"
EndIf
EndSubSub Session_Start(ByVal sender AsObject, ByVal e As EventArgs)
' Fires when the session is startedApplication("oUsers") =
(CInt(Application("oUsers")) + 1).ToString()
IfCInt(Application("oUsers")) > 1
ThenResponse.Redirect("NoAccess.aspx")
EndIf
EndSub
Sub Session_End(ByVal sender AsObject, ByVal e As EventArgs)
' Fires when the session endsApplication("oUsers") =
(CInt(Application("oUsers")) - 1).ToString()
EndSub
EndClass
In the real world though, some issues will arise like:
What if a user closes the browser without loggin out?
Good Luck
|
| Post Reply
|
| Re: How to make a web site be single access?? |
 |
Wed, 2 Apr 2008 17:24:15 +0000 |
I don't beleive that will work. How will you know when Session_End fires? It
won't fire when the browser window closes. It fires when either
Session.Abandon() is called or the Session timeout expires.
|
| Post Reply
|
| Re: How to make a web site be single access?? |
 |
Wed, 2 Apr 2008 17:32:46 +0000 |
OK. Thanks all for your kind responses.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|