To have an ASP.NET site's favicon change dynamically based on the theme currently selected, first put a favicon.ico file in each of the App_Themes/"ThemeName"/Images directories.
Then add a literal control to the <Head> of the masterpage:
1: <head>
2: <asp:Literal ID="FavIconLink" runat="server"></asp:Literal>
3: </head>
Finally, set the literal's text in the code behind file ensuring that each quote mark is properly escaped with backslashes beforehand:
1: protected void Page_Load(object sender, EventArgs e) 2: {3: FavIconLink.Text = "<link rel=\"shortcut icon\" href=\"../App_Themes/" + Page.Theme + "/Images/favicon.ico\" /> type=\"image/vnd.microsoft.icon\" ";
4: }