구글와이드(336x280)_상단 2개


(영문) ASP - Debugging 문제 Tips ASP, ASP.NET

Favorite Tips of IT Professionals (January 2000, IIS)
By Sandy Small, Principal Consultant, Microsoft Certified Professional, Sandy.small@softwarespectrum.com

T-Shirts for Tipsters, January 2000
We were very impressed by the IIS tips submitted by IT Professionals for the T-Shirts for Tipsters contest. The IIS product support team combed through them all and selected the very best to share with you.
Congratulations to the January winners!
IIS/ASP tip: Nobody writes perfect code, even though we would all like to. And it is especially hard when you are not sitting right by the development server so you can't use the debugger. And one of my least favorite things to do is strip out/comment out all the debugging code - those innumerable "response.write"s that remain once the Web application is completed. So when I start development, I create an ASP page called something clever like "debug.asp" which contains a self-submitting form with a selection of input buttons that do various helpful things like list session variables, or turn a debug session variable flag on or off when evaulated after submitting.
In my ASP pages, there is an if statement for each response.write, which shows debugging information, so it is displayed only if the debug flag is set:
if session("debug") then response.write "referer='" & Request.ServerVariables("HTTP_REFERER") & "'<br>"
No more need to comment out those unneeded debug lines! It is also helpful once the Web application goes into production, if there is a need to see what is going on to fix any bugs missed in development.
Sample ASP code for setting session variable in debug.asp:
<%
if Request("action") = "Debug On" then ' >>>>>>>>>>>>>> Debug On 
<<<<<<<<<<<<<<<<
session("debug") = true
response.write "<br><font color='red'><b>Debug flag is '" & session("debug") _
& "'</b></font><br>"

elseif Request("action") = "Debug Off" then ' >>>>>>>>>>>>>> Debug Off 
<<<<<<<<<<<<<<<<
session("debug") = false
response.write "<br><font color='red'><b>Debug flag is '" & session("debug") _
& "'</b></font><br>"

elseif Request("action") = "Abandon Session" then ' >>>>>>>>>>>>>> Abandon 
Session <<<<<<<<<<<<<<<<
response.write "<br><font color='red'><b>Session abandoned." _
& " All session variables destroyed.</b></font><br>"
session.abandon
end if
%>
<html>
<body>
<form name="debug" action="debug.asp" method="post">
<input type="submit" name="action" value="Debug On">
<input type="submit" name="action" value="Debug Off">
</form>
</body></html>
Carlos Matias
Director
GryphTech Inc.
Debugging ASP Pages:
Debugging is a pain with ASP - especially if you are developing for a client which has their own server and is not setup for debugging.
I use the following technique:
When I want to debug a page I add "&Debug=1" to the URL.
In my ASP page at the top I put:
<%
'Set the Request Object value to a local variable 
'for reduced overhead and cleaner code below
If Request("Debug") = "1" Then
Debug = True
End if
%>

<%
SQL = "Select * from tblAuthors where AuthID = " & AuthID

If Debug Then
Response.Write SQL
End if

rs.Source = SQL
rs.Open
%>
(출처: http://technet.microsoft.com/en-us/library/bb742542.aspx )

null



바보들의 영문법 카페(클릭!!)

오늘의 메모....

시사평론-정론직필 다음 카페
http://cafe.daum.net/sisa-1

바보들의 영문법 다음 카페
http://cafe.daum.net/babo-edu/

티스토리 내 블로그
http://earthly.tistory.com/

내 블로그에 있는 모든 글들과 자료에 대한 펌과 링크는 무제한 허용됩니다.
(단, 내 블로그에 덧글쓰기가 차단된 자들에게는 펌, 트랙백, 핑백 등이 일체 허용되지 않음.)

그리고 내 블로그 최근글 목록을 제목별로 보시려면....
바로 아래에 있는 이전글 목록의 최근달을 클릭하시면 됩니다.
그러면 제목을 보고 편하게 글을 골라 보실 수 있습니다.

그리고 내 블로그내 글을 검색하시려면 아래 검색버튼을 이용하시면 됩니다.


가가챗창

flag_Visitors

free counters