참여하세요참여하세요

리버'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
%>
이올린에 북마크하기(0) 이올린에 추천하기(0)
이 글의 관련글
일주일간 인기글
오늘 인기글

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

댓글을 달아 주세요

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

1  ... 100 101 102 103 104 105 106 107 108  ... 276 
BLOG main image
리버's 아름다운 소풍
이씨플라자 개발자가 살아가는 이야기
by 리버

카테고리

전체 (276)
살.아.가.며. (159)
웹.이.야.기. (57)
OS (13)
Software (15)
Security (4)
SQL Server (7)
Programming (18)

달력

«   2008/08   »
          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
31            
textcubeDesignMyselfget rss
Candle

1078

953

-30 days

today : 694