/// <summary> /// Returns a link to the given tilde directory path /// with the filename appended. /// /// The filename may be: /// /// * Empty, so a default servable file will be used /// /// * A pseudo filename handled by an IHttpHandler /// /// * Some other filename known to be present in the /// directory /// /// If the tilde directory path does not end is a slash /// then its file name component will be removed. /// /// Returns an empty string if an error occurs. /// </summary> /// <param name="context">Web site HttpContext object</param> /// <param name="tildeDirectoryPath">Tilde directory path</param> /// <param name="filename">Target file name</param> public static string MakeDirectoryLink (HttpContext context, string tildeDirectoryPath, string filename) { try { tildeDirectoryPath = HttpContextTools.GetDirectoryPath(tildeDirectoryPath); string directoryPath = HttpContextTools.MakeMergedPath(context, tildeDirectoryPath); if (filename == null) { filename = ""; } StringBuilder builder = new StringBuilder(); builder.Append(HTML_Tools.open_div); builder.Append(HTML_Tools.open_anchor); builder.Append(directoryPath); builder.Append(filename); builder.Append(HTML_Tools.mid_anchor_blank); builder.Append(HTML_Tools.open_code); builder.Append(tildeDirectoryPath); builder.Append(HTML_Tools.shut_code); builder.Append(HTML_Tools.shut_anchor); builder.Append(HTML_Tools.shut_div); return(builder.ToString()); } catch (Exception) { return(""); } }