ASP 101 - Active Server Pages 101 custom.aspx
<%@ Page Language="VB" %>
<script language="VB" runat="server">
	Sub Page_Load(sender as Object, e as EventArgs)
		If Not Page.IsPostBack Then
			' Read values from cookie
			Dim objCookie As HttpCookie
			objCookie = Request.Cookies("FontConfig")
			If Not(objCookie Is Nothing) Then
				selFamily.Value = objCookie.Values("family")
				selSize.Value   = objCookie.Values("size")
				selStyle.Value  = objCookie.Values("style")
				selWeight.Value = objCookie.Values("weight")
				selColor.Value  = objCookie.Values("color")
			End If
			FormatTextBasedOnFormValues
		End If
	End Sub
	Sub Preview_Click(sender as Object, e as EventArgs)
		FormatTextBasedOnFormValues
	End Sub
	Sub Cookie_Click(sender as Object, e as EventArgs)
		Dim objCookie As HttpCookie
		objCookie = New HttpCookie("FontConfig")
		objCookie.Values("family") = selFamily.Value
		objCookie.Values("size")   = selSize.Value
		objCookie.Values("style")  = selStyle.Value
		objCookie.Values("weight") = selWeight.Value
		objCookie.Values("color")  = selColor.Value
		objCookie.Expires = New DateTime(2010, 12, 31)
		Response.AppendCookie(objCookie)
 		FormatTextBasedOnFormValues
	End Sub
 	Sub FormatTextBasedOnFormValues()
		pCustomText.Style("font-family") = selFamily.Value
		pCustomText.Style("font-size")   = selSize.Value
		pCustomText.Style("font-style")  = selStyle.Value
		pCustomText.Style("font-weight") = selWeight.Value
		pCustomText.Style("color")       = selColor.Value
 	End Sub
</script>
<html>
<head>
  <title>ASP.NET Customization Sample</title>
</head>
<body>
<p id="pCustomText" runat="server">
This is the text that will vary in appearence based
on the settings you choose.
</p>
<form runat="server">
<select id="selFamily" runat="server">
  <option>Arial</option>
  <option>Courier</option>
  <option>Symbol</option>
  <option>Times</option>
</select>
<select id="selSize" runat="server">
  <option>8pt</option>
  <option>10pt</option>
  <option>12pt</option>
  <option>14pt</option>
  <option>16pt</option>
</select>
<select id="selStyle" runat="server">
  <option>Normal</option>
  <option>Italic</option>
</select>
<select id="selWeight" runat="server">
  <option>Normal</option>
  <option>Bold</option>
</select>
<select id="selColor" runat="server">
  <option value="#00FFFF">Aqua</option>
  <option value="#000000">Black</option>
  <option value="#0000FF">Blue</option>
  <option value="#FF00FF">Fushsia</option>
  <option value="#00FF00">Lime</option>
  <option value="#FF0000">Red</option>
  <option value="#FFFFFF">White</option>
  <option value="#FFFF00">Yellow</option>
</select>
<br />
<br />
<input type="button" Value="Preview Settings"
	OnServerClick="Preview_Click" runat="server" />
<input type="button" Value="Save Settings To A Cookie"
	OnServerClick="Cookie_Click" runat="server" />
</form>
<!--
Just a link back to this page without anything on the QueryString
so that the values from the cookie or the default values kick in.
-->
<a href="<%= Request.ServerVariables("URL") %>">
View using the settings saved in your cookie.
</a>
<hr />
<p>
Click <a href="http://www.asp101.com/samples/custom_aspx.asp">here</a> to read about and download the source code.
</p>
</body>
</html>