Is there a neat programmatic way to determine which Themes are installed in an ASP.NET application?
I have several ASP.NET applications that use a cookie with the name of “Theme” to set the theme in the Page PreInit event. The trouble is, when using localhost in my development environment, the theme name for one application gets presented to another application and thereby throws the exception:
Theme ‘XYZ’ cannot be found in the application or global theme directories.
I thought I might be able to just check which themes my application has first to see if what I’m about to set is valid – that is without looking at the content of the App_Themes folder.
I don’t think there is a way to do this without looking at the App_Themes folder.
But you can easily list the existing themes, using something like this:
Or to check if a given theme exists: