复制代码 代码如下:
using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace GetImage
{
/// <summary>
/// $codebehindclassname$ 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Img : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "image/jpg";
if (context.Request.UrlReferrer != null && context.Request.UrlReferrer.Host.Equals(context.Request.Url.Host, StringComparison.InvariantCultureIgnoreCase))
context.Response.WriteFile(context.Server.MapPath("~/" + context.Request.QueryString["img"]));
else
context.Response.WriteFile(context.Server.MapPath("~/logo.gif"));
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
新闻热点
疑难解答
图片精选