Created
September 20, 2011 15:21
-
-
Save 9thbit/1229391 to your computer and use it in GitHub Desktop.
ASP Util Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Print out everything in request.form | |
for each item in request.Form | |
response.Write item & ": '" & request.Form(item) & "'<br>" | |
next | |
response.flush | |
'--------------------------------------------------------------------------------- | |
'Recursively output full contents of an object. | |
sub debugObj(obj) | |
%><table border='1' cellspacing='0'><tr><th width='300px'>Item</th><th width='300px'>Value</th></tr><% | |
debugObj2 obj, "" | |
%></table><% | |
end sub | |
sub debugObj2(obj,pre) | |
on error resume next 'required to skip trying to cstr() objects like images | |
MAX_STR_LEN = 50 | |
for each item in obj | |
if isobject(obj(item)) then | |
debugObj2 obj(item),pre & item & "==>" | |
else | |
item_link=replace(pre,"==>","||") & item | |
item_name= pre & " " & item | |
item_val = cstr(obj(item)) | |
item_val2 = item_val | |
if len(item_name)>MAX_STR_LEN and MAX_STR_LEN>0 then item_name=left(item_name,MAX_STR_LEN) & "..." | |
if len(item_val)>MAX_STR_LEN and MAX_STR_LEN>0 then item_val=left(item_val,MAX_STR_LEN) & "..." | |
response.write "<tr><td>" & replace(item_name,search_str,rep) & "</td><td>" & _ | |
replace(server.HTMLencode(item_val),search_str,rep) & " </td></tr>" | |
end if | |
next | |
end sub | |
'Usage: | |
debugObj session.contents | |
debugObj application.contents | |
'--------------------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment