private static void AddAuthenticationHeader(this HttpRequestMessage message, HeaderType type, string token) { if (message.Headers.Authorization != null) { throw new InvalidOperationException("message already has an authentication header"); } message.Headers.Authorization = new AuthenticationHeaderValue(type.ToString(), token); }
/// <summary> /// 输出头内容 /// </summary> /// <param name="wr">流输出对象</param> /// <param name="Name">输出的内容名称,如果有</param> /// <param name="type">输出的内容类型,如果有</param> private static void WriteHeader(HttpResponse wr, string Name, HeaderType type) { if (!string.IsNullOrEmpty(Name)) { wr.AppendHeader(headerName, Name); } if (type != HeaderType.Empty) { wr.AppendHeader(headerType, type.ToString()); } }
public HeaderNode(HeaderType type) { TagName = type.ToString().ToLower(); this.type = type; }
public AccordionHeader(HeaderType type, AccordionBaseText component) { _type = type; _text = component.FormatView().Replace("\n", $" ({type.ToString().ToLower()})"); }
/// <summary> /// Returns the full html that can be embedded to create an anchor pointing to the appropriate location. /// </summary> /// <param name="headerType">html header type.</param> /// <returns></returns> public virtual string html_Header_With_Anchor(HeaderType headerType) { return("<" + headerType.ToString() + " " + Anchor + ">" + FriendlyName + "</" + headerType.ToString() + ">"); }
private static string GetOverrideBody(IEnumerable <string> destinations, HeaderType type, string body) => $"<hr/><h4>Testing Environment { type.ToString() } Redirect</h4><strong>{ type.ToString() } Recipient List:</strong><br/>{ string.Join(",<br/>", destinations) }<br/><br/><hr/>{ body }";
private Builder CreateHeading(HeaderType headerType, string content, string id, string htmlClass, Dictionary<string, object> attributes = null) { if (attributes == null) attributes = new Dictionary<string, object>(); if (id != null) attributes.Add("id", id); if (htmlClass != null) attributes.Add("class", htmlClass); var htmlAttributes = attributes.Aggregate("", (current, attribute) => current + String.Format(" {0}=\"{1}\"", attribute.Key, attribute.Value)); var tag = String.Format("<{0}{1}>{2}</{0}>", headerType.ToString().ToLower(), htmlAttributes, content); Html += tag; return this; }
public override string ToString() { return(base.ToString() + "HeaderType=" + HeaderType.ToString() + ", FileName=" + FileName.Replace("\0", "0").Trim() + ", FollowingDataLength=" + FollowingDataLength); }