리버's 아름다운 소풍

XSS방지를 위해 PHP에서는 htmlspecialchars함수를 사용하면 된다. ASP에서는 기본적으로 이런 기능의 함수가 없어서 같은 기능을 하는 함수를 만들었다. 사용자 입력 내용이 HTML로 출력될 때는 XSS방지를 위해서 반드시 htmlspecialchars함수를 써야 한다. 
<form method="post" action="test.asp">
<input type="text" name="test" value="<%=htmlspecialchars(Request("test"))%>">
<input type="submit">
</form>

<%
Function htmlspecialchars(sStr)
htmlspecialchars = Replace( sStr, "&", "&amp;" )
htmlspecialchars = Replace( htmlspecialchars, ">", "&gt;" )
htmlspecialchars = Replace( htmlspecialchars, "<", "&lt;" )
htmlspecialchars = Replace( htmlspecialchars, """", "&quot;" )
htmlspecialchars = Replace( htmlspecialchars, "'", "&#039;" )
End Function
%>
이 글의 관련글
일주일간 인기글
오늘 인기글

TRACKBACK :: http://pluto.ecplaza.net:8080/tt/river/trackback/224

댓글을 달아 주세요

[로그인][오픈아이디란?]

1  ... 115 116 117 118 119 120 121 122 123  ... 291 
BLOG main image
리버's 아름다운 소풍
이씨플라자 개발자가 살아가는 이야기
by 리버

카테고리

전체 (291)
살.아.가.며. (169)
웹.이.야.기. (60)
OS (13)
Software (16)
Security (4)
SQL Server (7)
Programming (19)

달력

«   2008/11   »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
textcubeDesignMyselfget rss
Candle

289

226

-30 days

today : 221