/// <summary> /// Handles the current request. /// </summary> /// <param name="context">The current context</param> /// <param name="args">Optional url arguments passed to the handler</param> public virtual void HandleRequest(HttpContext context, params string[] args) { if (args != null && args.Length > 0) { // // Http preview // Page page = Page.GetSingle(new Guid(args[0])); WebThumb.GetThumbnail(context.Response, page.Id, "http://" + context.Request.Url.DnsSafeHost + VirtualPathUtility.ToAbsolute("~/hem/" + page.Permalink), 300, 225); } }
private void CreateThumb(string thumbFile) { string html = ""; if (CreateImageCallback != null) { html = CreateImageCallback(txtTemplate.Text); } WebClient client = new WebClient(); string baseUrl = Request.Url.Scheme + "://" + Request.Url.Host; string url = Globals.NavigateURL(TabId); if (!url.StartsWith("http")) { url = baseUrl + url; } string page = (string)DataCache.GetCache("bbstore_producttemplate_" + TabId.ToString()); if (page == null) { page = client.DownloadString(url); int bodystart = page.IndexOf("<body"); if (bodystart > 0) { page = page.Substring(0, bodystart) + "<body><div style=\"padding:20px;\">{{PLACEHOLDER}}</div></body></html>"; } DataCache.SetCache("bbstore_producttemplate_" + TabId.ToString(), page); } if (html != string.Empty) { html = page.Replace("{{PLACEHOLDER}}", html); WebThumb thumbMaker = new WebThumb("DesktopModules\\BBStore", Request.Url.Scheme + "://" + Request.Url.Host); thumbMaker.MakeThumb(html, thumbFile); } }