日期:2014-05-17  浏览次数:20633 次

Web新人求助,在html中如何隐藏图片的真实地址?
本帖最后由 eakey 于 2013-06-04 20:22:00 编辑
<img src="http://b272.photo.store.qq.com/psb?/V122h2mV18h7Hj/z3nu2eC5bcpVCow8x35DGorRk7x.am2A3TbZO09QwyE!/m/dLv2IqKOEQAA&bo=IAMVAgAAAAABABM!">

src不用真实的url路径,而类似这样一串编码.这是如何做到的?
URL

------解决方案--------------------
 对文件名称可以 加码
------解决方案--------------------
估计人家又自己的一套编码机制,取图片地址时再解码!
------解决方案--------------------
 public class ResponseImg : IHttpHandler
    {
        static readonly DateTime Refresh;
        static readonly DateTime Now;
        static ResponseImg()
        {
            Now = DateTime.Now;
            Refresh = Now.AddMonths(1);
        }

        public void ProcessRequest(HttpContext context)
        {

            if (!string.IsNullOrEmpty(context.Request.Headers["If-Modified-Since"]))
            {
                DateTime IfModifiedSince = DateTime.Parse(context.Request.Headers["If-Modified-Since"]);
                if (IfModifiedSince > Now)
                {
                    context.Response.StatusCode = 304;
                    return;
                }
            }
            
            //string folder = context.Request.QueryString["Folder"];
            string filepath = context.Request.QueryString["FilePath"];
            int width = int.Parse(context.Request.QueryString["Width"]);
            int height = int.Parse(context.Request.QueryString["Height"]);
            string hex = context.Request.QueryString["Hex"