Blackhorse programmer _ ASP. NET anti-leech

Source: Internet
Author: User

------- Windows Phone 7 Mobile Phone development,. Net training, and we look forward to communicating with you! -------

 

In the learning process, I learned to use ASP. net anti-Leech, but I tried it, this anti-leech can only prevent the same use of ASP.. For reference only

Can I use a class to inherit ihttpmodule or ihandler? The ihandler in my program is occupied, so I use ihttpmodule.

Configuration file:

 

 

Code:

Using system; using system. collections. generic; using system. LINQ; using system. web; // <summary> /// MDO abstract description /// </Summary> public class httpmodule: ihttpmodule {public void Init (httpapplication context) {context. beginrequest + = new eventhandler (context_beginrequest);} void context_beginrequest (Object sender, eventargs e) {// obtain the current object httpapplication context = sender as httpapplication; If (context. request. urlreferrer = NULL) {} else {// determine whether the visitor is our own if (context. request. urlreferrer. host = "localhost" & context. request. urlreferrer. port = context. request. URL. port) {// if it is not processed, let it run normally} else // if it is a foreign personnel, do processing {// If the access type is image context. response. contenttype = "image/jpg"; // you can specify an incorrect image context. response. writefile (context. request. physicalapplicationpath + "admin/bookcovers/1323.jpg") ;}} public void dispose (){}}

 

------- Windows Phone 7 Mobile Phone development,. Net training, and we look forward to communicating with you! -------

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.