|
Technical Interview Questions
Visual Basic Interview Question
.NET Web Interview Questions
.NET
Interview Questions
C#
Interview Questions
.........More
Source Codes
Asp .NET Source Codes
Asp VB Script Source Codes
.........More
Soft Skills
Communication Skills
Leadership Skills
.........More
|
|
Asp/VB Script Source Codes
Check Active users on site
using ASP
<P align=left>This code snippet shows how to show how many active users there
are on your site , this is quite widely used on the internet.</P>
<P align=left>using your favorite text editor create the file global.asa and
enter the code below</P><SCRIPT LANGUAGE=VBScript RUNAT = Server><BR>Sub
Application_OnStart<BR>Application("visits")=0<BR>Application("Active")=0<BR>End
Sub<BR>Sub Application_OnEnd End SubSub Session_OnStart<BR>'set timeout to 20
mins<BR>Session.Timeout = 20<BR>Session("Start") = Now<BR>'increase count by
1<BR>Application.lock<BR>Application("visits") = Application("visits") + 1<BR>intTotal_visitors
= Application("visits")<BR>Application.unlock<BR>Session("VisitorID") =
intTotal_visitors<BR><BR>Application.lock<BR>Application("Active") =
Application("Active") + 1<BR>Application.unlock<BR>End Sub Sub <BR><BR>Session_OnEnd<BR>'decrease
by 1 when session ends<BR>Application.lock<BR>Application("Active") =
Application("Active") - 1<BR>Application.unlock<BR>End Sub<BR></script>
<P>Now add the following to a page to count the active users </P><b><%=
Session("VisitorID")%></b> visit(s)<BR><b><%=
Application("Active")%></b> visitor online
<P>If you look below you can see this in action </P>
<<<----- Return to
Asp/VB Script Source
Code Questions Page.
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Microsoft .Net Interview Questions
for more Microsoft
.Net Interview Questions with Answers.
Check
.Net Database Interview
Questions for more .Net Database Interview Questions with answers
Check
Job Interview Questions
for more Interview Questions with Answers
|