리버's 아름다운 소풍

Korean Semantic Web Conference - 12월 4일
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://river.ecplaza.net/river/trackback/224

댓글을 달아 주세요

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

1  ... 153 154 155 156 157 158 159 160 161  ... 328 
BLOG main image
리버's 아름다운 소풍
이씨플라자 개발자가 살아가는 이야기
by 리버

공지사항

카테고리

전체 (328)
살.아.가.며. (184)
웹.이.야.기. (75)
OS (13)
Software (17)
Security (4)
SQL Server (8)
Programming (24)

달력

«   2009/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          
get rss

495

402

-30 days

today : 66