public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, Object obj) { Boolean useFullValidation = AWS.Utils.WebUtils.GetFromString(ConfigurationManager.AppSettings["full-image-security-validation"], false); String imagePath; String requestPath = context.Request.FilePath; if (useFullValidation) { Boolean isThumbinal = context.Request.QueryString["thumb"] == null ? false:true; requestPath = context.Request.QueryString["id"]; /*else * { * if( (idx = requestPath.LastIndexOf(".")) != -1 ) * requestPath = requestPath.Substring( 0, idx ); * * if( (idx = requestPath.ToLower().LastIndexOf("_thumb")) != -1 ) * { * isThumbinal = true; * requestPath = requestPath.Substring( 0, idx ); * } * else * isThumbinal = false; * }*/ SiteMapProvider prov = AWS.Utils.WebUtils.GetCurrProvider(context.Request); SiteMapNode nd = prov.FindSiteMapNodeFromKey(requestPath); if (nd == null) { imagePath = context.Server.MapPath(requestPath); } else { requestPath = GetClientPath(nd, isThumbinal); if (!prov.SecurityTrimmingEnabled || prov.IsAccessibleToUser(context, nd)) { imagePath = context.Server.MapPath(requestPath); } else { throw new Exception(String.Format("Access to image is denied: '{0}'." + requestPath)); } } } else { imagePath = context.Server.MapPath(requestPath); } MyAsyncRequestState st = new MyAsyncRequestState(context, cb, obj, imagePath); Thread t = new Thread(new ThreadStart(st.ProcessRequest)); t.Start(); return(st); }
public void EndProcessRequest(IAsyncResult ar) { MyAsyncRequestState ars = ar as MyAsyncRequestState; if (ars != null) { ars.Dispose(); } }