2010-12-27 4 views
0

Ajax Control Toolkit 3.5를 사용하고 있습니다.해당 필드에 html 태그가있는 양식을 게시 할 때 오류가 발생합니다.

<body> 
<form id="form1" runat="server"> 
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> 
</asp:ToolkitScriptManager> 
<div> 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
     <ContentTemplate> 
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
      <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> 
      <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
     </ContentTemplate> 
    </asp:UpdatePanel> 
</div> 
</form> 

그리고이 페이지의 관련 코드 숨김이있다 : 나는이 같은 양식을 가지고

protected void Button1_Click(object sender, EventArgs e) 
{ 
    Label1.Text = TextBox1.Text; 
} 

내가 예를 들어 TextBox1에에 "foo는"쓰기로 그것이 성공적으로 복사 Label1. 하지만 IE의 상태 표시 줄에 "<B> foo는 </B >"내가 다음 얻을 자바 스크립트 오류와 같은 일부 HTML 태그를 텍스트 상자에 텍스트를 작성하는 경우 :

alt text

가 어떻게이 문제를 해결할 수 있습니까?

미리 감사드립니다.

답변

0

이 질문을 게시 한 직후, UpdatePanel에서 양식 필드를 가져 와서 동일한 작업을 다시 시도한다는 생각이 마음에 들었습니다. 빙고! 페이지의 <% @ 페이지 %> 섹션에 다음 코드를 추가하여 문제를이 오류 해결 본 후

A potentially dangerous Request.Form value was detected from the client (TextBox1="<b>foo</b>"). 
Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case. 

Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (TextBox1="<b>foo</b>"). 

에는 다음과 같은 예외가 발생합니다.

ValidateRequest="false" 

희망이 ...

다른 사람에게 도움이
관련 문제