NancyFX と ASP.Net を使用して、次のようなルート間でモデル オブジェクトを共有しようとしています。
Post["/"] = parameters =>
{
var myModel = new ExampleModel
{
Prop = (string) Request.Form["someField"],
};
try
{
Request.Session["myModel"] = myModel;
}
catch (Exception e)
{
return e.Message;
}
return Response.AsRedirect("/something/");
};
try-catch
これは、句にラップされているにもかかわらずクラッシュします。
作品の代わりに文字列を保存しますExampleModel
。
HttpSession
これは対Session
の問題 (ASP の互換性など)に関連していますか? 非文字列オブジェクトをルート間で共有するにはどうすればよいですか?