【问题标题】:OWIN/Katana middleware classic asp pages skipping pipelineOWIN/Katana 中间件经典 asp 页面跳过管道
【发布时间】:2017-05-10 17:43:09
【问题描述】:

我有一个基于 mvc 4.5 的经典 asp 应用程序,我正在尝试拦截对经典 asp 页面的调用,看起来我无法做到这一点。关于如何的任何想法。不知道如何让中间件拦截这些请求。看起来Can't find method app.UseStaticFiles() 类似,但他们使用的是模块。我希望能够使用中间件。

有什么想法吗?

添加startup.cs

    using System;
    using System.Threading.Tasks;
    using Microsoft.Owin;
    using Owin;
    using System.Web;
    using System.IO;
    using Microsoft.Owin.Extensions;
    using Microsoft.Owin.Security.Cookies;
    using Microsoft.Owin.Security.WsFederation;
    using Microsoft.Owin.Security;
    using Microsoft.IdentityModel;
    using System.Web.Helpers;
    using System.Security.Claims;
    using System.Collections.Generic;
    using System.Security.Principal;
    using System.Threading;
    using System.Web.Mvc;

    public void Configuration(IAppBuilder app)
    {
        // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
        ConfigureAuth(app);

    }

    private void ConfigureAuth(IAppBuilder app)
    {
        app.Use(typeof(LogMiddleware));
        app.UseCookieAuthentication(new CookieAuthenticationOptions()
        {

            CookieSecure = CookieSecureOption.Always,
            LoginPath = new PathString("/Account/Login"),
            ExpireTimeSpan = TimeSpan.FromMinutes(30),
            CookieDomain = MvcApplication.CookieDomian,
            CookiePath = MvcApplication.ApplicationPath,
            CookieName = "asp.net",
            CookieHttpOnly = true,
            AuthenticationMode = AuthenticationMode.Active,
        }
        });



        app.UseStageMarker(PipelineStage.Authenticate);

        app.MapWhen(
            context => context.Request.Path.ToString().EndsWith(".asp"),
            appBranch =>
            {
                System.Diagnostics.Debugger.Break();
            });
        app.Use(typeof(ResponseHeaderMiddleware));

【问题讨论】:

  • 请分享你的 startup.cs
  • 哇,Owin 上的经典 asp。我为你的勇敢鼓掌。
  • 我正在尝试,不是出于选择,但它不会拦截那些调用。我怀疑这与 owin 的全部意义在于摆脱 IIS 的事实有关。不确定我是否可以将自定义 http 模块与 owin 中间件混合使用
  • Marcus 对此有何想法?

标签: c# asp.net-mvc owin-middleware


【解决方案1】:

runallmanagedmodulesforallrequests 在网络配置中设置为 false..

将此设置为 true 并且它可以工作......谁会猜到。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-05
    • 1970-01-01
    • 1970-01-01
    • 2021-11-01
    • 2015-08-20
    • 2015-07-07
    • 2015-08-10
    相关资源
    最近更新 更多