' Mustang 14-Oct-2009 14:49 Partial Class Site Inherits System.Web.UI.MasterPage Private oTxt As New clsText Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init Dim strValue As String, strRights As String Const DEFAULT_RIGHTS As String = "VF" ' Values can be [V]iew, [Z]oom, [F]ilter, also [A]dd, [C]hange, [D]elete ' '// Get/Set cookies and session values if they have expired ' strValue = Session("UserName") If Len(strValue) >= 8 Then ' strValue '// This is a valid user name Response.Cookies("user")("UserName") = oTxt.xHexString(Session("UserName")) Response.Cookies("user")("Password") = oTxt.xHide(Session("Editing_Rights")) Response.Cookies("user").Expires = DateTime.Now.AddHours(20) Else ' strValue '// Not valid name. Try to find a cookie If Not Request.Cookies("user") Is Nothing Then ' Nothing '// Found cookie strValue = Request.Cookies("user")("UserName") strValue = oTxt.xDeHexString(strValue) If Len(strValue) >= 8 Then '// Found cookie's user name Session("UserName") = strValue '// Get the obfuscated user rights posing as a password strValue = Request.Cookies("user")("Password") strValue = oTxt.xUnHide(strValue) Session("Editing_Rights") = oTxt.AlphaSort(strValue) End If End If ' Nothing End If ' strValue ' '// Now set default rights ' strRights = oTxt.AlphaSort(DEFAULT_RIGHTS & Trim(Session("Editing_Rights") & "")) Session("AddYN") = CBool(InStr(1, strRights, "A") > 0) Session("ChgYN") = CBool(InStr(1, strRights, "C") > 0) Session("DelYN") = CBool(InStr(1, strRights, "D") > 0) Session("BrwYN") = CBool(InStr(1, strRights, "V") > 0) Session("ZoomYN") = CBool(InStr(1, strRights, "Z") > 0) Session("FilterYN") = CBool(InStr(1, strRights, "F") > 0) Session("Editing_Rights") = strRights End Sub End Class