Create a secure ashx file, ashx compile

Source: Internet
Author: User

<%@ WebHandler language= "C #" class= "Handler2"%>

Using System;
Using System.Web;

public class Handler2:ihttphandler {

public void ProcessRequest (HttpContext context) {
Context. Response.ContentType = "Text/plain";
Context. Response.Write ("Hello World");
}

public bool IsReusable {
get {
return false;
}
}

}

But in this case, it is possible to expose the code to the client.

By viewing

Code
<%@ WebHandler language= "C #" class= "Handler2"%>

The discovery can actually 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, which will keep your code safe.

Because

① Microsoft has set access rights to a variety of specific folders

② compiled code is rendered as DLL format, it is not easy to see the source.

Create a secure ashx file, ashx compile

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.