Jump to content
Tom Wellige

B.1 - Appendix B - Example usage outside call routing - Simple ASP webpage

Recommended Posts

New in v1.1.0



This example demonstrates how to make use of Persistent Variables in an ASP (Active Server Page) web page.


You will find it in the download package in the following folder

  • \examples\External\asp


This little web page is meant to be used within a WebExtension in a SwyxIt! skin.


It displays the current status of the installed Night Switch example (new: also part of this package).


By clicking into the web page the status of the night switch will be toggled.




<meta http-equiv="refresh" content="2;url=<%=Request.ServerVariables("SCRIPT_NAME")%>">

  body.on  { background: #FFFF00; }
  body.off { background: #C0C0C0; }
  a        { padding:    48% 50%; }

<!-- #include file = "PersistentVariables.inc"-->

	' configure the complete db connect string
	g_sPersistentVariableConnectString = _
		"Provider=sqloledb;" & _
		"Data Source=WS-WELLIGE04;" & _
		"Initial Catalog=" & PERSISTENT_VARIABLE_DATABASE & ";" & _
		"User Id=PersistentVariables;" & _

	' initialize persistent variable
	Dim NightSwitch
	Set NightSwitch     = new PersistentVariable
	NightSwitch.Name    = "NightSwitch"
	NightSwitch.Default = 0

	' evaluate url parameter	
	sUrlSwitch = Request.QueryString("switch")
	if (sUrlSwitch <> "") and IsNumeric(sUrlSwitch) then NightSwitch.Value = CInt(sUrlSwitch)

	' set display styles
	if NightSwitch.Value = 0 then
		sStyle  = "off"
		sSwitch = "1"
		sStyle  = "on"
		sSwitch = "0"
	end if

	Set NightSwitch = Nothing

	sURL = Request.ServerVariables("SCRIPT_NAME") & "?switch=" & sSwitch


<body class="<%=sStyle%>">
	<a href="<%=sURL%>"> </a>


You have to make sure, that the PersistenVariables.inc file is in the same folder as the default.asp file.


Please find a complete explanation of the usage of persistent variables outside of call routing scripts here:




<< Previous A.2 - Appendix A - Example Night Switch - Night Switch enabled call routing script

>> Next B.2 - Appendix B - Example usage outside call routing - Simple VBS/WSF script


Share this post

Link to post
Share on other sites

  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.