ashx,Global.asax也改成代码分离形式。

2022-12-02,,,,


 %>

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

 

 %>

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

因为

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

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

 

Global.asax

在App_Code中添加Global.asax.cs,然后设置Global.asax的属性Inherits="Global"或CodeBehind="Global.asax.cs"即可(如:<%@ Application Language="C#" Codebehind="Global.asax.cs" %> )。