80 likes | 191 Vues
This guide focuses on improving the security and performance of ASP server pages. It emphasizes the importance of session management, ensuring only authorized users can access specific pages. It includes techniques for handling special characters to prevent SQL injection and XSS attacks. Performance enhancements are also covered, such as avoiding unnecessary session variables and using best practices for database connections. Adopting these methods can lead to more secure and efficient web applications, ultimately improving user experience.
E N D
Seoul Education & Science Research Institue Active Server Pages 정 영 식 nurunso@comedu.knue.ac.kr http://nurunso.pe.kr
부록 : ToolTip • 글 제목의 글자 수 제한 • If Len(title) > 30 Then • title = Mid(title. 1, 27) & “…” • End If
ASP 보안 • 세션이 있는 User만 페이지 보기 • If IsEmpty(Session(“check”)) or • IsNull(Session(“check”)) or • Session(“check”)=“” • Then • response.redirect “NoAccess.asp” • Else • response.redirect “ok.asp” • End If
특수 문자 처리 1 • HTML SQL • Function CheckWord(value) • value = replace(value, “&”, “&”) • value = replace(value, “<”, “<”) • value = replace(value, “>”, “>”) • value = replace(value, “’”, “"”) • CheckWord = value • End Function
특수 문자 처리 2 • SQL HTML • Function CheckWord(value) • value = replace(value, “&”, “&”) • value = replace(value, “<”, “<”) • value = replace(value, “>”, “>”) • value = replace(value, “"”, “’”) • CheckWord = value • End Function
Content 출력 • 다음 문장 입력 시 <input type=“button” value=“바보”> • 출력 결과 • Replace(content, “<“, “<”) Replace(content, “>“, “>”)
ASP 문장으로 이미지 출력 • 태그 안의 “”는 ‘’로 고친다. Response.write(“<img src=‘image/aa.gif’>”)
ASP 성능 향상 • 가급적 Session 변수를 사용하지 않는다. • Option Explicit를 사용한다. • 생성된 객체는 Close하고 파괴하라. • Collection의 값을 로컬 변수로 복사한다. • DB 연결에 대해서 include file을 이용하라. • <% @EnableSessionState=False%> 를 사용하라. • ADO 상수 사용 시 숫자 대신에 Named 상수를 사용하라. • 사용자의 입력 확인 시 client side Script 사용하라.