我写的一个ASP 程序:Application、Session、Cookie 查看/编辑器

类别:Asp 点击:0 评论:0 推荐:
<%@ Language=VBScript codepage=936%> <%Option Explicit '######################################################## '-----------------------------------------------------------------------------------'App Name: Sessions Applications Cookies Explorer for ASP ' Version: 2.0.20050320 ' LastModified: March,20 2005 ' Author: gExplorer ' My Site: http://www.dotNez.com/' '----| 作品说明 |--------------------------------------------------------------------------------- ' 声明: ' 1.本人对3821公司及其所有产品极度反感并对其支持者抱同-样态度。 ' 如果你是3821的支持者,请勿使用本人的任何作品!谢谢! ' 2.对于那个什么"我梦里 * 他MM千百度"的那个败毒公司,垃圾一个,我的态度同上 ' 3.本人不敢担保本人写的任何程序是绝对安全可靠的,所以对使用-任何本人免费公开的程序引起的任何后果 ' 本人将不会负任何责任 ' 4.本程序对任何个人、商业公司和任何单位免费。你可以免费使用-、修改。 ' 但请尊重作者劳动成果,保留版权声明、版权链接。我知道这是老生-常谈了,但我知道 ' 肯定会有那种贱人做这种贱事~`````对于这种人,我的态度同-上面第 2 条 ' 5.如有任何疑问或问题,本人欢迎各位使用者与我联系询问相关问-题,联系方法见后 ' ' ' 说明: ' 编写/调试 ASP 程序时,如果能够随意查看/修改 Session、Application 和 Cookie 变量的话,调试起来 ' 就方便多了。 于是我就写了那么一个 ASP 程序,专门用来查看/修改 Session、Application 和 Cookie 变量。 ' 个人觉得这小东西非常好用非常方便(自家孩子最漂亮 ^__^ )。 ' 为了更方便的调试 ASP 程序,我还特意加了一个在远程服务器上运行指定 ASP 程序段(必须是 VBScript 脚本) ' 的功能。使用方法自己找了,别来问我,反正不难。 ' 还有,由于写程序的时候懒得把输入法换来换去的,我就把所有的提-示都用了英文,英文不好的朋友别怪我啊 ^__^ ' 本程序编写过程中参考过的网站(部分): ' ' http://www.Google.com 当今Internet上最好用、最有名、最强悍的搜索引擎 ' 一旦使用过它,你绝对不会再想用别的搜索引擎! ' (你说什么?摆渡?那个我梦里 * 他MM千百度的那个败毒?它算什么东西?!!垃圾。。。) ' ' http://www.im286.com 国内最有人气的专门讨论网站开发维护的论坛 ' 站长们的集散地,强烈推荐,不过注册前提是你要有点底子 ^__^ ' http://www.csdn.net 国内软件开发技术第一网站,如果你是玩编程的却不知道这个网站的-话。。。 ' ' 联系方法: ' Email: gExplorer#Gmail.com 请把邮件地址中的 # 号改成 @ ,别告诉我连这个你都不知道 ^__^ ' QQ#: 9288151 ' MSN: gExplorer#Gmail.com '---------------------------------------------------------------------------------------------------------- '#############################-##############################-##############################-############## 'On Error Resume Next Response.Buffer = True Dim sScriptName sScriptName = Request.ServerVariables("SCRIP-T_NAME") Dim sMessage Dim strApplicationKeys,strSessionK-eys,strCookieKeys Dim strKeyType,strKeyValue Dim ApplicationKey,SessionKey,Cook-ie,CookieKey Dim nKeyValueLenght,nApplicationKe-yCount,nSessionKeyCount,nCooki-eKeyCount Dim sExecuteScriptPanelText,sExecu-teScriptPanelVisible Dim sApplicationPanelText,sApplica-tionPanelVisible Dim sSessionPanelText,sSessionPane-lVisible Dim sCookiePanelText,sCookiePanelV-isible Dim sHideText,sShowText,sVisible,s-Hidden sHideText = "Hide Panel" sShowText = "Show Panel" sVisible = "visible" sHidden = "hidden" '---------------------------------------------------------------------- nKeyValueLenght = 0 nApplicationKeyCount = 0 nSessionKeyCount = 0 nCookieKeyCount = 0 '---------------------------------------------------------------------------------- Dim sAction,sKeyToRemove,sCookieTo-Remove,sPanelName,sPanelVisibl-e,sPanelText Dim sNewKeyName,sNewKeyValue,sNewC-ookieName sAction = Request.QueryString("Action") sKeyToRemove = Request.QueryString("Key") Select Case LCase(sAction) Case LCase("RemoveApplicationKey") Call RemoveApplicationKey(sKeyToRem-ove) Case LCase("RemoveSessionKey") Call RemoveSessionKey(sKeyToRemove) Case LCase("RemoveCookie") sCookieToRemove = Request.QueryString("Cookie") sKeyToRemove = Request.QueryString("Key") Call RemoveCookie(sCookieToRemove,s-KeyToRemove) Case LCase("EditApplicationKey") sNewKeyName = Request.QueryString("Applicati-onKeyName") sNewKeyValue = Request.QueryString("Applicati-onKeyValue") Call EditApplicationKey(sNewKeyName-,sNewKeyValue) Case LCase("EditSessionKey") sNewKeyName = Request.QueryString("SessionKe-yName") sNewKeyValue = Request.QueryString("SessionKe-yValue") Call EditSessionKey(sNewKeyName,sNe-wKeyValue) Case LCase("EditCookie") sNewCookieName = Request.QueryString("CookieNam-e") sNewKeyName = Request.QueryString("CookieKey-Name") sNewKeyValue = Request.QueryString("CookieKey-Value") Call EditCookie(sNewCookieName,sNew-KeyName,sNewKeyValue) Case LCase("ClearApplicationKeys") Application.Contents.RemoveAll Case LCase("ClearSessionKeys") Session.Contents.RemoveAll Case LCase("ClearCookies") Call ClearCookies() Response.Redirect(sScriptName) Case LCase("Hide Panel") sPanelName = Request.QueryString("panelName-") sPanelVisible = sPanelName & "Visible" sPanelText = sPanelName & "Text" Session(sPanelVisible) = sHidden Session(sPanelText) = sShowText Response.Redirect(sScriptName) Case LCase("Show Panel") sPanelName = Request.QueryString("panelName-") sPanelVisible = sPanelName & "Visible" sPanelText = sPanelName & "Text" Session(sPanelVisible) = sVisible Session(sPanelText) = sHideText Response.Redirect(sScriptName) Case LCase("ExecuteScripts") Dim sScripts sScripts = Request("ScriptsToExecute") Call ExecuteScripts(sScripts) End Select Call GetPanelStatus() Call GetApplicationKeys() Call GetSessionKeys() Call GetCookies() '-------------------------------------------------------------------------------- Function GetPanelText(panelName) If Session(panelName & "Visible") = sVisible Then GetPanelText = sHideText Else GetPanelText = sShowText End If End Function Function GetPanelStatus() sExecuteScriptPanelVisible = Session("ExecuteScriptPanelVis-ible") sApplicationPanelVisible = Session("ApplicationPanelVisib-le") sSessionPanelVisible = Session("SessionPanelVisible") sCookiePanelVisible = Session("CookiePanelVisible") If sExecuteScriptPanelVisible = "" Then Session("ExecuteScriptPanelVis-ible") = sVisible Session("ExecuteScriptPanelTex-t") = sHideText End If If sApplicationPanelVisible = "" Then Session("ApplicationPanelVisib-le") = sVisible Session("ApplicationPanelText"-) = sHideText End If If sSessionPanelVisible = "" Then Session("SessionPanelVisible") = sVisible Session("SessionPanelText") = sHideText End If If sCookiePanelVisible = "" Then Session("CookiePanelVisible") = sVisible Session("CookiePanelText") = sHideText End If sExecuteScriptPanelVisible = Session("ExecuteScriptPanelVis-ible") sApplicationPanelVisible = Session("ApplicationPanelVisib-le") sSessionPanelVisible = Session("SessionPanelVisible") sCookiePanelVisible = Session("CookiePanelVisible") sExecuteScriptPanelText = Session("ExecuteScriptPanelTex-t") sApplicationPanelText = Session("ApplicationPanelText"-) sSessionPanelText = Session("SessionPanelText") sCookiePanelText = Session("CookiePanelText") End Function '---------------------------------------------------------------------------------- Function RemoveApplicationKey(sKey) Application.Contents.Remove(sK-ey) End Function Function RemoveSessionKey(sKey) Session.Contents.Remove(sKey) End Function Function RemoveCookie(sCookieToRemove,s-Key) If sCookieToRemove <> "" Then Response.Cookies(sCookieToRemo-ve)(sKey) = "" Else Response.Cookies(sCookieToRemo-ve).Expires = -1 End IF End Function '------------------------------------------------------------------------------- Function EditApplicationKey(sKeyName,Ke-yValue) If IsObject(KeyValue) Then Set Application(sKeyName) = KeyValue Else Application(sKeyName) = KeyValue End If End Function Function EditSessionKey(sKeyName,KeyVal-ue) If IsObject(KeyValue) Then Set Session(sKeyName) = KeyValue Else Session(sKeyName) = KeyValue End If End Function Function EditCookie(sCookieName,sKeyNam-e,sKeyValue) If sCookieName = "" And sKeyName = "" Then Exit Function ElseIf sCookieName <> "" And sKeyName <> "" Then Response.Cookies(sCookieName)(-sKeyName) = sKeyValue ElseIf sCookieName = "" And sKeyName <> "" Then 'Response.write "cookieName: " & sCookieName & "<br>KeyName: " & sKeyName Response.Cookies(sKeyName) = sKeyValue ElseIf sCookieName <> "" And sKeyName = "" Then Response.write "cookieName: " & sCookieName & "<br>KeyName: " & sKeyName Response.Cookies(sCookieName) = sKeyValue End If End Function '-------------------------------------------------------------------------------- Function GetApplicationKeys() For Each ApplicationKey In Application.Contents nApplicationKeyCount = nApplicationKeyCount + 1 strKeyType = TypeName(Application( ApplicationKey )) If strKeyType = "Object" Or strKeyType = "Nothing" Then strKeyValue = " - This Key Contains an Object" Else strKeyValue = Application(ApplicationKey) nKeyValueLenght = Len(strKeyValue) End If nKeyValueLenght = Len(strKeyValue) strApplicationKeys = _ strApplicationKeys & _ "<tr><td align=""center"" width=""50"" height=""14"">" & _ "<a href=""?Action=RemoveApplicati-onKey&Key=" & ApplicationKey & """>Remove</a></td>" & _ "<td width=""50"" height=""14""> " & strKeyType & "</td>" & _ "<td width=""150"" height=""14""> " & ApplicationKey & "</td>" & VbCrLf &_ "<td height=""14"">[" & nKeyValueLenght & "]" & strKeyValue & "</td></tr>" & VbCrLf Next If strApplicationKeys = "" Then strApplicationKeys = " There are no Application-Keys stored in the server." Else If sApplicationPanelVisible = sHidden Then strApplicationKeys = " Click [Show Panel] above to show this edit panel" Exit Function End If End If End Function Function GetSessionKeys() For Each SessionKey In Session.Contents nSessionKeyCount = nSessionKeyCount + 1 strKeyType = TypeName(Session( SessionKey )) If strKeyType = "Object" Or strKeyType = "Nothing" Then strKeyValue = " - This Key Contains an Object" Else strKeyValue = Session( SessionKey ) End If nKeyValueLenght = Len(strKeyValue) strSessionKeys = _ strSessionKeys & _ "<tr><td align=""center"" width=""50"" height=""14"">" & _ "<a href=""?Action=RemoveSessionKe-y&Key=" & SessionKey & """>Remove</a></td>" & _ "<td width=""50"" height=""14""> " & strKeyType & "</td>" &_ "<td width=""150"" height=""14""> " & SessionKey &"</td>" & VbCrLf & "<td height=""14"">[" & nKeyValueLenght & "]" & strKeyValue & "</td></tr>" & VbCrLf Next If strSessionKeys = "" Then strSessionKeys = " There are no Session-Keys stored in the server." Else If sSessionPanelVisible = sHidden Then strSessionKeys = " Click [Show Panel] above to show this edit panel" End If End If End Function Function GetCookies() For Each Cookie In Request.Cookies If Request.Cookies(Cookie).HasKey-s Then For Each CookieKey In Request.Cookies(Cookie) nCookieKeyCount = nCookieKeyCount + 1 strKeyValue = Request.Cookies(Cookie)(Cookie-Key) strKeyType = "String" nKeyValueLenght = Len(strKeyValue) strCookieKeys = _ strCookieKeys & _ "<tr><td align=""center"" width=""50"" height=""14"">" & _ "<a href=""?Action=RemoveCookie&Co-okie=" & Cookie & "&Key=" & CookieKey & """>Remove</a></td>" & _ "<td width=""50"" height=""14""> " & strKeyType & "</td>" & _ "<td width=""150"" height=""14""> " & Cookie& "." & CookieKey &"</td>" & VbCrLf & "<td height=""14"">[" & nKeyValueLenght & "]" & strKeyValue & "</td></tr>" & VbCrLf Next Else nCookieKeyCount = nCookieKeyCount + 1 strKeyValue = Request.Cookies(Cookie) strKeyType = "String" nKeyValueLenght = Len(strKeyValue) strCookieKeys = _ strCookieKeys & _ "<tr><td align=""center"" width=""50"" height=""14"">" & _ "<a href=""?Action=RemoveCookieKey-&Cookie=""" & Cookie & """>Remove</a></td>" & _ "<td width=""50"" height=""14""> " & strKeyType & "</td>" & _ "<td width=""150"" height=""14""> " & Cookie &"</td>" & VbCrLf & "<td height=""14"">[" & nKeyValueLenght & "]" & strKeyValue & "</td></tr>" & VbCrLf End If Next If strCookieKeys = "" Then strCookieKeys = " There are no Cookies in this computer." Else If sCookiePanelVisible = sHidden Then strCookieKeys = " Click [Show Panel] above to show this edit panel" End If End If End Function '---------------------------------------------------------------------------------------------- Function ClearCookies() For Each Cookie In Request.Cookies Response.Cookies(Cookie).Expir-es = -1 ' If Request.Cookies(Cookie).HasKey-s Then ' For Each CookieKey In Request.Cookies(Cookie) ' Response.Cookies(Cookie)(Cooki-eKey) = "" ' Next ' Else ' Response.Cookies(Cookie) = "" ' End If Next End Function Function ExecuteScripts(sScriptsToExecu-te) On Error Resume Next Execute(sScriptsToExecute) If Err Then sMessage = "   [<font color=""red"">Execute Message : There are someting wrong in the scripts you posted.</font>]" Else sMessage = "   [Execute Message : Script has been executed succefully.]" End If End Function %> <html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Docu-ment"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>Application Session Cookies Manager 1.0</title> <style> body { color: #FF0000; font-size: 12px; background-color:#005593; font-family: Tahoma, Verdana, "宋体"; scrollbar-darkshadow-color: #808080; scrollbar-face-color: #EEEEEE; scrollbar-highlight-color: #FFFFFF; scrollbar-shadow-color: #DEE3E7; scrollbar-3dlight-color: #D1D7DC; scrollbar-arrow-color: #000000; scrollbar-track-color: #EDEDED; } input { border-top-width: 1px; padding-right: 1px; padding-left: 1px; border-left-width: 1px; border-bottom-width: 1px; border-right-width: 1px; padding-bottom: 1px; padding-top: 1px; border-left-color: #C0C0C0; border-bottom-color: #C0C0C0; border-top-color: #C0C0C0; border-right-color: #C0C0C0; font-family: Tahoma, Verdana, "宋体"; font-size: 11px; height: 18px; color: #000000; background-color: #FFFFFF; } textarea,subject { padding:4px border-width: 1px; border-color: #c0c0c0; background-color: #FFFFFF; font-family: Tahoma, Verdana, "宋体"; font-size: 12px; color: #000000; } table { padding:0px; border-top:0px; border-bottom:0px; border-collapse: collapse; border-color:#111111; font-family: Tahoma, Verdana, "宋体"; color: #000000; font-size: 12px; } td { border-collapse: collapse; border-color:#111111; font-family: Tahoma, Verdana, "宋体"; color: #000000; font-size: 12px; word-break:break-all; } a:link,a:visited { text-decoration: none; color:#003063; font-family: Tahoma, Verdana, "宋体"; } a:hover { text-decoration: none; color:#FF0000; font-family: Tahoma, Verdana, "宋体"; } </Style> </head> <body> <br> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="20"> <tr> <td width="120" height="14" align="center"> <a href="http://www.dotNez.com/" target="_BLANK" class="aa"> dotNez's </a> </td> <td width="" align="center" height="14"> <font color="#FFFFFF"> Sessions Applications Cookies Explorer for ASP - Version 1.0</font> </td> </tr> </table> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="20"> <tr> <td width="100%" height="14" bgcolor="#C0C0C0"> Applic-ation.Contents - <%=nApplicationKeyCount%> key(s) - | <a href="?Action=<%=GetPanelText(-"ApplicationPanel")%>&panelNam-e=ApplicationPanel"><%=GetPane-lText("ApplicationPanel")%></a-> | <a href="?Action=ClearApplication-Keys">Remove All</a> |</td> </tr> <tr><form name="EditApplicationKeyForm" method="GET" action=""> <td width="100%" height="14" bgcolor="#F0F0F0"> Add/Ed-it : <input type="Hidden" name="Action" Value="EditApplicationKey"> <input type="text" name="ApplicationKeyName" size="15"> = <textarea name="ApplicationKeyValue" cols="90" rows="1"></textarea> <input type="submit" value="Add/Edit" name="btnEditApplicationKey"> </td> </tr></form> <tr> <td width="100%" height="14" bgcolor="#F0F0F0"> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="5"> <%=strApplicationKeys%> </table> </td> </tr> </table> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="20"> <tr> <td width="100%" height="14" bgcolor="#C0C0C0"> Sessio-n.Contents - <%=nSessionKeyCount%> key(s) - | <a href="?Action=<%=GetPanelText(-"SessionPanel")%>&panelName=Se-ssionPanel"><%=GetPanelText("S-essionPanel")%></a> | <a href="?Action=ClearSessionKeys-">Remove All</a> |</td> </tr> <tr><form name="EditSessionKeyForm" method="GET" action=""> <td width="100%" height="14" bgcolor="#F0F0F0"> Add/Ed-it : <input type="Hidden" name="Action" Value="EditSessionKey"> <input type="text" name="SessionKeyName" size="15"> = <textarea name="SessionKeyValue" cols="90" rows="1"></textarea> <input type="submit" value="Add/Edit" name="btnEditNewApp"> </td></form> </tr> <tr> <td width="100%" height="14" bgcolor="#F0F0F0"> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="5"> <%=strSessionKeys%> </table> </td> </tr> </table> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="20"> <tr> <td width="100%" height="14" bgcolor="#C0C0C0">  Request.Cookies - <%=nCookieKeyCount%> key(s) - | <a href="?Action=<%=GetPanelText(-"CookiePanel")%>&panelName=Coo-kiePanel"> <%=GetPanelText("CookiePanel")-%> </a> |<a href="?Action=ClearCookies"> Remove All </a>| </td> </tr> <tr><form name="EditCookieForm" method="GET" action=""> <td width="100%" height="14" bgcolor="#F0F0F0"> Add/Ed-it : <input type="Hidden" name="Action" Value="EditCookie"> <input type="text" name="CookieName" size="15"> . <input type="text" name="CookieKeyName" size="15"> = <textarea name="CookieKeyValue" cols="70" rows="1"></textarea> <input type="submit" value="Add/Edit" name="btnEditCookie"> </td> </tr></form> <tr> <td width="100%" height="14" bgcolor="#F0F0F0"> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="5"> <%=strCookieKeys%> </table> </td> </tr> </table> <table border="1" cellpadding="0" cellspacing="0" width="100%"> <tr> <td height="14" bgcolor="#C0C0C0" colspan="3"> Execute Scripts - |<a href="?Action=<%=GetPanelText(-"ExecuteScriptPanel")%>&panelN-ame=ExecuteScriptPanel"> <%=GetPanelText("ExecuteScript-Panel")%> </a>|<%=sMessage%></td> </tr> </table> <% If LCase(sExecuteScriptPanelVisib-le) = "visible" Then %> <table border="1" cellpadding="0" cellspacing="0" width="100%" bgcolor="#F0F0F0"> <tr><form name="ExecuteScriptsForm" method="POST" action="?Action=ExecuteScripts-"> <td width=""> <textarea name="ScriptsToExecute" cols="114" rows="5">Enter you ASP scripts here and click button "Execute Scripts" to execute it</textarea> </td> <td width="100%" height="14"> <input type="submit" value="Execute Scripts" name="btnExecuteScripts"> <input type="Reset" value="Reset Textarea" name="btnReset"><br> <input type="button" value="Copy to Clipboard" name="btnCopy"><br> <input type="button" value="Paste From Clipboard" name="btnPaste"><br> </td> </tr></form> </table> <% End If %> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="20"> <tr> <td width="100%" align="center" height="14"> <font color="#FFFFFF">Copyright (c) 2005</font> <a href="http://www.dotNez.com" target="_blank"><font color="#FFFFFF">http://www.dotNez.com</font></a> </td> </tr> </table> </body> </html>

本文地址:http://com.8s8s.com/it/it7140.htm