防盗链

防盗链就是不想自己的资源被别人轻而易举的获取。

原理就是当请求的Referer不为空时要判断下域名

 Uri referer = Request.UrlReferrer;
            if ( referer != null)
            {

                //TODO:到时候改回来
                string host = referer.Host;
                if ((host.IndexOf(".aqioo.com") == -1))
                {
                    Response.Redirect("http://www.aqioo.com", true);
                    return;
                }
           } 
View Code
原文地址:https://www.cnblogs.com/lihongchen/p/4359867.html