wyb
2021-05-11 49ce087bd2a34a150597e1cc1da157af242c0b6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace Pcb.Api.Infrastructures
{
    /// <summary>
    /// 
    /// </summary>
    public class HttpInterceptModule : IHttpModule
    {
        public void Dispose()
        {
            //throw new NotImplementedException();
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ContextAuthenticateRequest(object sender, EventArgs e)
        {
            HttpApplication app = (HttpApplication)sender;
            var absolutePath = HttpContext.Current.Request.Url.AbsolutePath.ToLower();
            if (absolutePath == "/") HttpContext.Current.Response.Redirect("/swagger");
        }
 
        public void Init(HttpApplication context)
        {
            context.AuthenticateRequest += ContextAuthenticateRequest;
        }
    }
}