MVC4/Web API プロジェクトがあり、Ajax を使用して Web API を使用するテスト ページを作成しました。テストは順調に進んでいたので、UI の作業を開始しました。私がしなければならなかったことの 1 つは、Web API から返されたデータをいくつかのフォーム コントロールに入力することでした。これにはJQueryを使用しました。
ここで、アプリケーションを実行してフォームを送信すると、ページが更新されたことを示すエラーが表示されます。
Invalid postback or callback argument. Event validation is enabled using <pages
enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %>
in a page. For security purposes, this feature verifies that arguments to postback
or callback events originate from the server control that originally rendered them.
If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation
method in order to register the postback or callback data for validation.
この問題を解決するために、フォーム コントロールを UpdatePanel でラップし、ScriptManager コントロールを追加しました。ビルド時に次のエラーが表示されるようになりました。
The type or namespace name 'ScriptManager' does not exist in the namespace
'System.Web.UI' (are you missing an assembly reference?) C:\Users\xxx\Documents\
Visual Studio 2012\Projects\xxxxxxxxx\xxxxxxxx.Web.API\Public\
xxxxxxxxxxx.aspx.designer.cs 31 41 xxxxxxxx.Web.API
と
The type or namespace name 'UpdatePanel' does not exist in the namespace
'System.Web.UI' (are you missing an assembly reference?) C:\Users\xxx\Documents\
Visual Studio 2012\Projects\xxxxxxxx\xxxxxxxx.Web.API\Public\
xxxxxxxxxxx.aspx.designer.cs 40 41 xxxxxxxx.Web.API
私は自分のソリューションを完全にきれいにしました。obj/Debug と obj/Release を削除。私はこれら 2 つの問題を調査しましたが、これらの問題は密接に関連しているように思われます。AjaxControlToolbox をインストールしましたが、違いはありませんでした。
手動で web.config に追加する必要があるもの、または探しているものはありますか?