OWIN / Katana中间件经典asp页面跳过管道

时间:2017-05-10 17:43:10

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

我在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));

1 个答案:

答案 0 :(得分:0)

在web配置中将runallmanagedmodulesforallrequests设置为false ..

将此设置为true并且它有效......谁会猜到。