複数のページを持つASP.net MVC Webサイトを構築しましたが、すべて動作します。しかし、数分(10〜30分)開いたままでページを投稿しようとすると、シーケンスに要素が含まれていないとのエラーメッセージが表示され、その他の作業が行われます。シーケンス要素がありません
フォームはかみそりのコードを使用して構築さ: @using (Html.BeginForm("Index", "Beoordeling", FormMethod.Post, new { @id = "beoordelingForm" })) { ... }
コントローラメソッドは次のようになります。いくつかの時間のために開いているページを離れるとき
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Index([Bind(Include = allparameters")] object ObjectName)
{
}
再度こののみ発生します。 ページを開くときに使用するだけであれば、問題はありません。
この問題は、すべての自分のASP.NET MVC Webサイトで発生します。
私はこれがフォームの設定/デフォルト動作であると思いますが、誰かがエラーメッセージを表示する理由を説明してください。
Server Error in '/' Application.
Sequence contains no elements Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains no elements
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[InvalidOperationException: Sequence contains no elements] System.Linq.Enumerable.First(IEnumerable`1 source) +264
linqコールはどこですか? –
私はこれがValidateAntiForgeryTokenのためかもしれないと思う、それはサーバー側で検証されるクッキーを作成する、私はあなたがクッキーが期限切れになったと言いた後に思う。 –
このエラーは、私が知る限り、linq呼び出しがないようにフォームをポストする場合にのみ発生します。 @ DanielA.White。 – Sdaele