Exemple #1
0
    public static ImageCache GetImageCache(string imagesPath)
    {
        ImageCache cache = HttpContext.Current.Cache[imagesPath] as ImageCache;

        if (cache == null)
        {
            cache = ImageCache.Create(imagesPath);
            if (Directory.Exists(imagesPath))
            {
                HttpContext.Current.Cache.Add(
                    imagesPath,
                    cache,
                    new CacheDependency(new string[] { imagesPath }),
                    Cache.NoAbsoluteExpiration,
                    Cache.NoSlidingExpiration,
                    CacheItemPriority.Normal,
                    null);
            }
        }
        return(cache);
    }
Exemple #2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     new Thread(new ThreadStart((Action) delegate { ImageCache.Create(Server.MapPath(ImageUrl.Text)); })).Start();
 }