This is what I use to get an array of the name of all themes:
public static string[] GetThemes()
{
if (HttpContext.Current.Cache["SiteThemes"] != null)
{
return (string[])HttpContext.Current.Cache["SiteThemes"];
}
else
{
string themesDirPath = HttpContext.Current.Server.MapPath("~/App_Themes");
string[] themes = Directory.GetDirectories(themesDirPath);
for (int i = 0; i <= themes.Length - 1; i++)
themes[i] = Path.GetFileName(themes[i]);
// cache the array
CacheDependency dep = new CacheDependency(themesDirPath);
HttpContext.Current.Cache.Insert("SiteThemes", themes, dep);
return themes;
}
}
JJ
"WT" <WT@newsgroups.nospamwrote in message
news:uz**************@TK2MSFTNGP04.phx.gbl...
Hello,
I need to list all available themes for a .NET app, is there any API in
.NET2 for this or should I explore the folder files using IO methods ?
Thanks for indication
CS