我使用ninject将HttpSessionStateBase注入自定义SessionData类。此Session数据类在注入的http会话中设置字典对象。会话数据类被注入控制器。
当您访问页面时,视图模型数据会附加到此字典中。如果您在Chrome中执行此操作,然后在FireFox中打开该网站,则会填写所有表单数据。这是怎么回事。关于要寻找什么的任何建议?
这是ninject绑定:
private static IKernel CreateKernel()
{
var kernel = new StandardKernel();
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
kernel.Bind<HttpRequestBase>().ToMethod(b => b.Kernel.Get<HttpContextBase>().Request)
.InRequestScope();
kernel.Bind<HttpResponseBase>().ToMethod(b => b.Kernel.Get<HttpContextBase>().Response)
.InRequestScope();
kernel.Bind<HttpServerUtilityBase>().ToMethod(b => b.Kernel.Get<HttpContextBase>().Server)
.InRequestScope();
kernel.Bind<HttpSessionStateBase>().ToMethod(b => b.Kernel.Get<HttpContextBase>().Session)
.InRequestScope();
kernel.Bind<ISessionData>().To<SessionData>().InRequestScope();
RegisterServices(kernel);
return kernel;
}