少なくとも.Net4.0を使用していると思いますか?私はあなたの質問に従って小さな例を挙げ、同じ振る舞いに気づきました。Fortunatelly私は簡単な解決策を見つけました(ここでもStackoverflow-asp.netテキストボックスでhtmlを許可します)。
aspx
<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeFile="commonQuestions.aspx.cs" Inherits="commonQuestions" %>
.....
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" Height="81px" TextMode="MultiLine" Width="264px"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
codeBehind
protected void Button1_Click(object sender, EventArgs e)
{
// do something
Debug.WriteLine("Text: " + TextBox1.Text);
}
web.configに追加
<httpRuntime requestValidationMode="2.0" />
そしてここで、ASP.Net 4の変更点を参照して、MSからかなり良い説明を得ました。
その結果、以前はエラーをトリガーしなかったリクエストに対して、リクエスト検証エラーが発生する可能性があります。ASP.NET 2.0要求検証機能の動作に戻すには
、Web.configファイルに設定(上記を参照)を追加します。