平时系统默认创建的ashx如下格式:

 

 Handler2 : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType 
= "text/plain";
        context.Response.Write(
"Hello World");
    }
 
    
public bool IsReusable {
        
get {
            
return false;
        }
    }

}

但是这样的话,很可能把代码暴露给客户端。

通过查看

%>

发现其实可以把ashx文件和具体的代码分开。

 

%>

把实现的代码存放到app_code文件夹下面,这样可以保证代码的安全。

因为

①微软给各种特定的文件夹设定了访问权限

②编译之后的代码呈现为dll格式,不容易查看源码。

相关文章:

  • 2022-12-23
  • 2022-02-05
  • 2021-11-06
  • 2022-02-16
  • 2021-08-22
  • 2021-08-09
猜你喜欢
  • 2021-12-27
  • 2021-12-31
相关资源
相似解决方案