private static void InitRenderOptions(VxeRender itemRender, ComboboxAttribute comboAttr) { itemRender.Options = WebConsts .GetComboboxDataFunc(comboAttr.Type.Name, comboAttr.WhereField, comboAttr.WhereOper, comboAttr.WhereValue, comboAttr.DisplayField).ConfigureAwait(false).GetAwaiter().GetResult() .Select(x => new LabelValue(x.Key, x.Value)).ToList(); }
/// <summary> /// Configures response with redirect status and headers. This method DOES NOT ABORT the work pipeline,so /// the processing of filters and handlers continues unless 'work.Aborted = true' is issued in code. /// See also 'RedirectAndAbort(url)' /// </summary> public void Redirect(string url, WebConsts.RedirectCode code = WebConsts.RedirectCode.Found_302) { //20160707 DKh m_NetResponse.Redirect(url); m_NetResponse.Headers.Set(HttpResponseHeader.Location, url); m_NetResponse.StatusCode = WebConsts.GetRedirectStatusCode(code); m_NetResponse.StatusDescription = WebConsts.GetRedirectStatusDescription(code); }
public void Execute(Controller controller, WorkContext work) { var cache = Caching; var useETag = UseETag; if (BinaryOffset > 0 || BinarySize > 0) { useETag = false; } if (useETag && !cache.HasValue) { cache = new CacheControl { Cacheability = CacheControl.Type.Private, MustRevalidate = true, ProxyRevalidate = true, NoTransform = true, MaxAgeSec = 0 }; } if (cache.HasValue) { work.Response.SetCacheControlHeaders(cache.Value, true); } if (Content.ModifyDate.HasValue) { work.Response.Headers[HttpResponseHeader.LastModified] = WebUtils.DateTimeToHTTPLastModifiedHeaderDateTime(Content.ModifyDate.Value); } if (useETag) { var etag = $"\"{Content.ETag}\""; work.Response.Headers[HttpResponseHeader.ETag] = etag; var clETag = work.Request.Headers["If-None-Match"]; if (clETag.IsNotNullOrWhiteSpace()) { if (clETag.EqualsOrdSenseCase(etag)) { work.Response.StatusCode = WebConsts.GetRedirectStatusCode(WebConsts.RedirectCode.NotModified_304); work.Response.StatusDescription = WebConsts.GetRedirectStatusDescription(WebConsts.RedirectCode.NotModified_304); return; } } } work.Response.ContentType = Content.ContentType; if (Content.IsString) { work.Response.Write(Content.StringContent); } else { var bin = Content.BinaryContent; var idx = BinaryOffset <= 0 || BinaryOffset >= bin.Length ? 0 : BinaryOffset; var sz = BinarySize <= 0 || idx + BinarySize >= bin.Length ? bin.Length - idx : BinarySize; string attachmentName = null; if (IsAttachment) { attachmentName = this.AttachmentName.Default(Content.AttachmentFileName); } using (var ms = new MemoryStream(bin, idx, sz)) { work.Response.WriteStream(ms, attachmentName: attachmentName); } } }