Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Text" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
FontFamily[] families = new InstalledFontCollection().Families;
ListView1.DataSource = families;
ListView1.DataBind();
Label1.Text = "All Font Families installed on the server: " + Environment.MachineName;
}
</script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Installed Fonts</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<ol>
<asp:ListView ID="ListView1" runat="server" ItemType="FontFamily">
<ItemTemplate>
<li>
<%#:Item.Name%>
</li>
</ItemTemplate>
</asp:ListView>
</ol>
</div>
</form>
</body>
</html>
Note, installing a new Font on a Windows server may not reflect till recycling the application pool (for .net web applications), restarting the service (for Windows service-based apps). Rebooting OS directly will not help in few scenarios.
Article ID: 2242, Created: December 16, 2022 at 3:07 AM, Modified: September 19 at 4:04 AM