2014-04-30 4 views
0

C# 및 VS 2010 사용.
일부 최종 테스트를 수행하기 위해 일부 영역을 보호해야하는 것으로 나타났습니다. 테스트 간단한 스크립트를 사용 : 팝업 메시지와 함께 페이지 나누기 물론
XSS 공격 및 HtmlEncode

<script>alert('123');</script> 

: 페이지 지시문에서

JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: 
An unknown error occurred while processing the request on the server. 
The status code returned from the server was: 500 

가이 설정되어

ValidateRequest="false" 

그리고 또한 인코딩 할 텍스트 상자가있는 AntiXSSLibrary를 사용합니다.

string test = Encoder.HtmlEncode(txtSomeTextBox.Text); 

위의 오류는 업데이트 패널이있는 페이지에서 발생합니다. updatepanel없는 페이지
및 테스트, 오류는 다음과 같습니다뿐만 아니라 해당 페이지에

A potentially dangerous Request.Form value was detected from the client 
(ctl00$ContentPlaceHolder1$txtTest="<script>alert('123')..."). 

동일한 코드.
입력되는 정보는 SQL Server에 저장되고 나중에 동료가 볼 수 있습니다.

페이지가 깨지는 이유는 무엇입니까?
HtmlEncode가 예상대로 작동하지 않는 이유는 무엇입니까?
모든 의견을 환영합니다.

+1

[잠재적으로 위험한 Request.Form 값이 클라이언트에서 발견되었습니다]의 중복 가능성이 있음 (http://stackoverflow.com/questions/81991/a-potentially-dangerous-request-form-value-was-detected-from) - 클라이언트) – ElGavilan

답변

0

감사합니다.
나는 몇 시간 동안 어디에서나 운이없는 곳을 수색했다.
특히 여기.
이제는 web.config 파일을 간단하게 조정하는 방법을 알 수 있습니다.

<httpRuntime requestValidationMode="2.0" /> 

감사합니다 !!!!!