次のコードをUpdate Panelの下にあるページに書きました。ここでResponse.Redirect()を使用しているときにスレッドの中止例外を取得する
protected void myGrid_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
if (e.CommandName =="EditNames")
{
long lSelectedName = Convert.ToInt64(e.CommandArgument);
Session["SelectedItem"] = lSelectedName;
Response.Redirect("EditItem.aspx");
}
else if (e.CommandName =="DeleteNames")
{
long lSelectedName = Convert.ToInt64(e.CommandArgument);
ValidName.DeleteItem(lSelectedName);
ScriptManager.RegisterStartupScript(this, GetType(), "Key", "alert('Name deleted sucessfully')", true);
}
}
catch (System.Threading.ThreadAbortException)
{
}
catch (Exception ex)
{
Error handling code...
}
リダイレクトながら、私は、スレッドアボート例外を取得しています。どのように、私はエラーハンドラSystem.threading.ThreadAbortExceptionを使用して解決しました。
しかし、リダイレクト中にそのエラーが発生した理由がわかりません。 、私はこの問題を解決したとしても、私は...あなたの入力を与えるすべての
で焼成し、エラーを停止するにはどのような方法があり、私はコーディングまたはAMの方法のいずれかの間違いがある知っていただきたいと思います
ページが、私はこの問題を解決していますが、私が知りたいのです
[なぜResponse.Redirectが原因でSystem.Threading.ThreadAbortExceptionが発生するのですか?](http://stackoverflow.com/questions/2777105/why-response-redirect-causes-system-threading-threadabortexception) –