From: http://blog.sina.com.cn/s/blog_6d52f3600100qnrx.html Thank you
The default ashx format is as follows:
Code
<% @ WebHandler Language = "C #" Class = "Handler2"
%>
UsingSystem;
UsingSystem. Web;
PublicClassHandler2:IHttpHandler{
PublicVoidProcessRequest(HttpContextContext)
{
Context. Response. ContentType=
"Text/plain ";
Context. Response. Write ("HelloWorld ");
}
PublicBoolIsReusable{
Get{
ReturnFalse;
}
}
}
However, the Code may be exposed to the client.
View
Code
<% @ WebHandler Language = "C #" Class = "Handler2"
%>
We can separate the ashx file from the specific code.
Code
<% @ WebHandler Language = "C #" Class = "Handler2"
CodeBehind = "Handle2.cs" %>
Store the implemented code under the app_code folder to ensure code security.
Because
① Microsoft has set access permissions for various specific folders
② The compiled code is displayed in the dll format, so it is not easy to view the source code.