SoFunction
Updated on 2025-03-01

HttpHandler implements image anti-theft chain


using System;
using ;

namespace CustomHandler{
public class JpgHandler : IHttpHandler{
public void ProcessRequest(HttpContext context){
// Get the physical path of the file server
string FileName = ();
// If UrlReferrer is empty, a default image that prohibits link theft will be displayed
if ( == null){
= "image/JPEG";
("/");
}else{
// If the UrlReferrer does not contain its own site host domain name, a default image that prohibits link theft will be displayed
if (("") > 0){
= "image/JPEG";
(FileName);
}else{
= "image/JPEG";
("/");
}
}
}

public bool IsReusable{
get{ return true; }
}
}
}