本文整理汇总了C#中IPipelines.EnableInProcSessions方法的典型用法代码示例。如果您正苦于以下问题:C# IPipelines.EnableInProcSessions方法的具体用法?C# IPipelines.EnableInProcSessions怎么用?C# IPipelines.EnableInProcSessions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPipelines
的用法示例。
在下文中一共展示了IPipelines.EnableInProcSessions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplicationStartup
protected override void ApplicationStartup(ILifetimeScope container, IPipelines pipelines)
{
StaticConfiguration.DisableErrorTraces = false;
// Enable memory sessions, and secure them against session hijacking
pipelines.EnableInProcSessions();
pipelines.BeforeRequest.AddItemToStartOfPipeline(ctx => {
var antiSessionHijackLogic = container.Resolve<IAntiSessionHijackLogic>();
return antiSessionHijackLogic.InterceptHijackedSession(ctx.Request);
});
pipelines.AfterRequest.AddItemToEndOfPipeline(ctx => {
var antiSessionHijackLogic = container.Resolve<IAntiSessionHijackLogic>();
antiSessionHijackLogic.ProtectResponseFromSessionHijacking(ctx);
});
// Load the user from the AspNet session. If one is found, create a Nancy identity and assign it.
pipelines.BeforeRequest.AddItemToEndOfPipeline(ctx => {
var identityAssigner = container.Resolve<INancyIdentityFromContextAssigner>();
identityAssigner.AssignNancyIdentityFromContext(ctx);
return null;
});
pipelines.OnError = pipelines.OnError
+ ErrorPipelines.HandleModelBindingException()
+ ErrorPipelines.HandleRequestValidationException()
+ ErrorPipelines.HandleSecurityException();
base.ApplicationStartup(container, pipelines);
}
示例2: ApplicationStartup
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) {
StaticConfiguration.DisableErrorTraces = false;
var sessionConfig = new InProcSessionsConfiguration {
SessionTimeout = TimeSpan.FromMinutes(3),
CacheTrimInterval = TimeSpan.FromMinutes(10),
SessionIdentificationMethod = new ByQueryStringParamIdentificationMethod(CryptographyConfiguration.Default)
};
pipelines.EnableInProcSessions(sessionConfig);
base.ApplicationStartup(container, pipelines);
}