The first is the httphandler class code:
Using system; using system. collections. generic; using system. web; namespace httphandler {public class handler: ihttphandler {# region ihttphandler member public bool isreusable {get {return true;} public void processrequest (httpcontext context) {string filename = context. request. filepath; If (context. request. urlreferrer. host = NULL) {context. response. contenttype = "image/JPEG"; context. response. writefile ("/no.jpg");} else {If (context. request. urlreferrer. host. indexof ("localhost")> = 0) {context. response. contenttype = "image/JPEG"; context. response. writefile (filename);} else {context. response. contenttype = "image/JPEG"; context. response. writefile ("/no.jpg") ;}}# endregion }}
Then there is the code in Web. config:
<configuration><system.web>
The last mile is the JPG file in the root directory of the website.