【问题标题】:How to catch application/json and text/html requests in Application_BeginRequest如何在 Application_BeginRequest 中捕获 application/json 和 text/html 请求
【发布时间】:2016-03-07 10:53:41
【问题描述】:

如何在Application_BeginRequest 中捕获application/jsontext/html 请求?` 我已经尝试迭代 Request.AcceptTypes,但我不确定这是不是正确的方法。

【问题讨论】:

    标签: asp.net global-asax


    【解决方案1】:

    我认为this 是你要找的:

    if (ConfigurationManager.AppSettings["Maintenance_Mode"] == "on")
    {
        Context.RewritePath("Maintenance.aspx");
    }
    

    【讨论】:

    • 我需要 Application_BeginRequest 来实现维护模式。
    猜你喜欢
    • 1970-01-01
    • 2014-12-22
    • 1970-01-01
    • 2019-01-07
    • 2016-12-22
    • 1970-01-01
    • 2019-09-30
    • 1970-01-01
    • 2018-03-22
    相关资源
    最近更新 更多