Important alert: (current site time 7/15/2013 10:37:08 PM EDT)
 

VB icon

Cookie Debugger

Email
Submitted on: 6/21/2001 2:31:30 PM
By: Lewis E. Moten III  
Level: Beginner
User Rating: By 1 Users
Compatibility: ASP (Active Server Pages)
Views: 19839
author picture
(About the author)
 
     Creates a list of all cookies and there crumbs along with the values assigned to each one.
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
' for :Cookie Debugger
'**************************************
Copyright (c) 2001, Lewis Edward Moten III. All rights reserved.
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: Cookie Debugger
' Description:Creates a list of all cookies and there crumbs along with the values assigned to each one.
' By: Lewis E. Moten III
'
' Returns:Returns an orderd list of names and values of cookies and crumbs.
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6724&lngWId=4'for details.'**************************************

Response.Write CookieData()
Function CookieData()
	Dim llngMaxCookieIndex
	Dim llngCookieIndex
	Dim llngMaxCrumbIndex
	Dim llngCrumbIndex
	Dim lstrDebug
	' Count Cookies
	llngMaxCookieIndex = Request.Cookies.Count
	
	' Let user know if cookies do not exist
	If llngMaxCookieIndex = 0 Then
		CookieData = "cookie data is empty."
		Exit Function
	End If
	
	' Begin building a list of all cookies
	lstrDebug = "<OL>"
	
	' Loop through each cookie
	For llngCookieIndex = 1 To llngMaxCookieIndex
		lstrDebug = lstrDebug & "<LI>" & Server.HTMLEncode(Request.Cookies.Key(llngCookieIndex))
		
		' Count the crumbs
		llngMaxCrumbIndex = Request.Cookies(llngCookieIndex).Count
		
		' If the cookie doesn't have crumbs ...
		If llngMaxCrumbIndex = 0 Then
			lstrDebug = lstrDebug & " = "
			lstrDebug = lstrDebug & Server.HTMLEncode(Request.Cookies.Item(llngCookieIndex))
		' Else loop through each crumb
		Else
			lstrDebug = lstrDebug & "<OL>"
			For llngCrumbIndex = 1 to llngMaxCrumbIndex
				lstrDebug = lstrDebug & "<LI>"
				lstrDebug = lstrDebug & Server.HTMLEncode(Request.Cookies(llngCookieIndex).Key(llngCrumbIndex))
				lstrDebug = lstrDebug & " = "
				lstrDebug = lstrDebug & Server.HTMLEncode(Request.Cookies(llngCookieIndex)(llngCrumbIndex))
				lstrDebug = lstrDebug & "</LI>"
			Next
			lstrDebug = lstrDebug & "</OL>"
		End If
		lstrDebug = lstrDebug & "</LI>"
	Next
	lstrDebug = lstrDebug & "</OL>"
	' Return the data
	CookieData = lstrDebug
	
End Function


Other 102 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
1/29/2002 11:58:49 AMFrancois Bujold

HI
i am interested in the code but cannot make it work properly. can you explain how you implemented it? I tried running the script server side and client side without much success.
thank you
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.