复制代码 代码如下:
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
if (null != context.Request.UrlReferrer)
{
context.Response.Expires = 0;
context.Response.Clear();
context.Response.ContentType = "image/jpg";
context.Response.WriteFile(context.Request.PhysicalPath);
context.Response.End();
}
else
{
context.Response.Expires = 0;
context.Response.Clear();
context.Response.ContentType = "text/html";
context.Response.Write("盗链");
context.Response.End();
}
}
复制代码 代码如下:
<httpHandlers>
<add verb="*" path="*.jpg" type="Namespace.ForbiddenInvaliteDownload,Namespace"/>
</httpHandlers>
复制代码 代码如下:
if (null != context.Request.UrlReferrer && context.Session["visited"] == "true")
{
context.Response.Expires = 0;
context.Response.Clear();
context.Response.ContentType = "image/jpg";
context.Response.WriteFile(context.Request.PhysicalPath);
context.Response.End();
}
else
{
context.Response.Expires = 0;
context.Response.Clear();
context.Response.ContentType = "image/jpg";
context.Response.WriteFile(context.Request.PhysicalApplicationPath + "Images/2.jpg");
context.Response.End();
}
新闻热点
疑难解答
图片精选