本文是  1     public class HookModule : IHttpModule
 2     {
 3 
 4         #region IHttpModule 成员
 5 
 6         public void Dispose()
 7         {
 8             
 9         }
10 
11         public void Init(HttpApplication context)
12         {
13             context.BeginRequest += new EventHandler(context_BeginRequest);
14         }
15 
16         void context_BeginRequest(object sender, EventArgs e)
17         {
18             
19             HttpApplication application = (HttpApplication)sender;
20             HttpContext context = application.Context;
21             IdentifyEncoding ie = new IdentifyEncoding();
22 
23             
24             string rawurl = context.Request.RawUrl;
25             rawurl = HttpUtility.UrlDecode(rawurl);
26             byte[] bytes = System.Web.HttpUtility.UrlDecodeToBytes(rawurl, Encoding.Default);
27 
28             Encoding enc = Encoding.Default;
29             try
30             {
31                 enc = Encoding.GetEncoding(ie.GetEncodingName(IdentifyEncoding.ToSByteArray(bytes)));
32             }
33             catch { }
34             string s = enc.GetString(bytes);
35             context.RewritePath(s);
36         }
37 
38 
39 
40         #endregion
41     }

相关文章:

  • 2022-12-23
  • 2021-10-29
  • 2021-11-13
  • 2022-02-10
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-02
  • 2021-10-12
  • 2021-10-08
  • 2021-10-13
  • 2021-07-31
  • 2021-06-21
  • 2022-02-23
相关资源
相似解决方案