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);
        }
示例#2
0
 /// <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());
     }
 }
示例#3
0
 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()})");
 }
示例#5
0
文件: CivBase.cs 项目: ls612/CFCGen
 /// <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() + ">");
 }
示例#6
0
 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 }";
示例#7
0
        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);
 }