private static string GetImageTag(string source, object htmlAttributes) { IDictionary<string, object> attributes = (htmlAttributes == null ? new RouteValueDictionary() : new RouteValueDictionary(htmlAttributes)); var builder = new TagBuilder("img"); builder.Attributes["src"] = source; builder.MergeAttributes(attributes); return builder.ToString(TagRenderMode.SelfClosing); }