ASP/VBScript
<%
If Session("SessionVarName") = "ValueToMatch" Then 
Response.Redirect("PageToRedirect") 
End If
%>
ASP/JavaScript
<%
if(Session("SessionVarName") == "ValueToMatch") {
Response.Redirect("PageToRedirect");
}
%>
ASP.NET VB
<%
If Session("SessionVarName") = "ValueToMatch" Then 
Response.Redirect("PageToRedirect") 
End If
%>
ASP.NET C#
<%
if(Session["SessionVarName"] == "ValueToMatch") {
Response.Redirect("PageToRedirect");
}
%>
JSP
<%
if(session.getAttribute("SessionVarName") == "ValueToMatch"){
response.sendRedirect("PageToRedirect");
}
%>
ColdFusion
<cfif IsDefined("Session.SessionVarName") AND 
Session.SessionVarName EQ "ValueToMatch">
<cflocation url="PageToRedirect">
</cfif>
PHP MySQL
<?php
if(isset($_SESSION["SessionVarName"]) && 
$_SESSION["SessionVarName"] == "ValueToMatch") { 
header("Location: PageToRedirect"); 
}
?>

ASP/VBScript
Block 1

<%
Function highlightSearchWord(theField, theSearchWord)
Dim before, after, myRegExp
before = "<strong>"
after = "</strong>"
Set myRegExp = New RegExp
With myRegExp
.Pattern = "(" & theSearchWord & ")"
.IgnoreCase = True
.Global = True
End With
highlightSearchWord = myRegExp.Replace(theField, before & "$1" & after)
Set RegularExpressionObject = nothing 
End Function
%>

Block 2

<%=highlightSearchWord(rs.Fields.Item("Field").Value, 
rs__searchfield)%>

ASP/JavaScript
Block 1


<%
function highlightSearchWord(theField, theSearchWord){
if(theSearchWord == "") return theField;
var before = "<strong>";
var after = "</strong>";
theSearchWord = new RegExp("(" + theSearchWord + ")","ig");
theField = theField.replace(theSearchWord, before + "$1" + after);
return theField;
}
%>

Block 2

<%=highlightSearchWord(rs.Fields.Item("Field").Value, 
rs__searchfield)%>

ASP.NET VB
Block 1


<script runat="server" language="VB">
Public Function highlightSearchWord(ByVal theField As String, 
ByVal theSearchWord As String) As String
If theSearchWord = "" Then 
return theField 
End If 
Dim before as String = "<strong>"
Dim after as String= "</strong>"
theSearchWord = "(" & theSearchWord & ")"
theField = Regex.Replace(theField, theSearchWord, 
before & "$1" & after, RegexOptions.IgnoreCase)
highlightSearchWord = theField
End Function
</script>

Block 2 

<%# highlightSearchWord(rs.FieldValue("Field", Container), 
(IIf((Request.QueryString("searchfield") <> Nothing), 
Request.QueryString("searchfield"), ""))) %>

ASP.NET C#
Block 1


<script runat="server">
public string highlightSearchWord(string theField, string theSearchWord){
if(theSearchWord == "") return theField;
string before = "<strong>";
string after = "</strong>";
theSearchWord = "(" + theSearchWord + ")";
theField = Regex.Replace(theField, theSearchWord, 
before + "$1" + after, RegexOptions.IgnoreCase);
return theField;
}
</script>

Block 2

<%# highlightSearchWord(rs.FieldValue("Field", Container), 
(((Request.QueryString["searchfield"] != null) && 
(Request.QueryString["searchfield"].Length > 0)) ? 
Request.QueryString["searchfield"] : ""))%>

JSP
Block 1


<%!
public String highlightSearchWord(String theField, String theSearchWord){
if(theSearchWord == "") return theField;
java.util.regex.Pattern pat = 
java.util.regex.Pattern.compile(theSearchWord = "(?im)(" + theSearchWord + ")");
java.util.regex.Matcher matcher = pat.matcher(theField);
String before = "<strong>";
String after = "</strong>";
theField = matcher.replaceAll(before + "$1" + after);
return theField;
};
%>

Block 2

<%= highlightSearchWord(rs.getString("field"), rs__searchfield)%>

ColdFusion
Block 1


<cffunction name="highlightSearchWord">
<cfargument name="theField" type="string" default="">
<cfargument name="theSearchWord" type="string" default="">
<cfif theField EQ "">
<cfreturn theField>
</cfif>
<cfset before = "<strong>">
<cfset after = "</strong>">
<cfset theSearchWord = "(#theSearchWord#)">
<cfset theField = REReplaceNoCase(theField, theSearchWord, 
"#before#\1#after#","all")>
<cfreturn theField>
</cffunction>

Block 2

#highlightSearchWord(rs.Field, URL.searchfield)#

PHP MySQL
Block 1


<?php
function highlightSearchWord($theField, $theSearchWord){
if($theSearchWord == "") return $theField;
$before = "<strong>";
$after = "</strong>";
$theSearchWord = "(" + $theSearchWord + ")";
$theField = preg_replace($theSearchWord, $before + "$1" + $after, $theField);
return $theField;
}
?>

Block 2

<?php echo highlightSearchWord($row_rs['Field'], 
$searchfield_rs); ?>


<!-- Redirect On Session Value Copyright 2004 by Thomas Muck -->
<macromedia-extension
name="Redirect on Session Value
version="1.0.0"
type="ServerBehavior"
requires-restart="true">

<products>
<product name="Dreamweaver" version="6" />
</products>

<author name="Thomas Muck"/>

<description>
<![CDATA[
Redirect a user to another page depending on the value
of a session variable.
]]>
</description>

<ui-access>
<![CDATA[
Access this extension by choosing:<br>
Server Behaviors >> Redirect On Session Value
]]>
</ui-access>

<!-- Describe the files that comprise the extension -->
<files> 
<file name="Redirect On Session Value.htm" 
destination="$dreamweaver/Configuration/ServerBehaviors/ASP_Vbs/"> </file>
<file name="Redirect On Session Value.edml" 
destination="$dreamweaver/Configuration/ServerBehaviors/ASP_Vbs/"> </file>
<file name="RedirectOnSession_block1.edml" 
destination="$dreamweaver/Configuration/ServerBehaviors/ASP_Vbs/"> </file>
</files>
</macromedia-extension>