ASPX : Theme for error pages

I set Page.Theme = "someTheme" in the Pre-Init handler of my Error404 page, which is in a directory called "Error"
If this page is evoked, I get a further error:
    Could not find a part of the path 'E:\web\xxx\htdocs\entries\Errors\App_Themes'.
How do I specify that the App_Themes directory is at the same level as the Errors directory?
PhotoCompManagerAsked:
Who is Participating?
 
Alfred A.Connect With a Mentor Commented:
It looks like Error folder is your "root" folder if you are getting that error.  I don't think you can easily move the  "Root/App_Theme" folder setup.  App_Theme folder is a special ASP.NET folder and it is a reserved name.  

http://msdn.microsoft.com/en-us/library/ex526337%28v=VS.90%29.aspx

When you do this for example, <%@ Page Theme="ThemeName" %>, ASP.NET knows exactly where to look because of the "Root/App_Themes" structure.  Intellisense will also list all available Themes when you try to put the theme name.

However, if you really are looking to override the location for App_Themes, check this link below:

http://www.joeaudette.com/overriding-the-location-for-app_themes.aspx

The link above is in C# but you can convert it to VB using conversion tools:

http://www.developerfusion.com/tools/convert/csharp-to-vb/

http://www.carlosag.net/Tools/CodeTranslator/

I hope this helps.
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Im not sure but if you try:
Page.Theme = "~someTheme"

Open in new window

0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Or
Page.Theme = "~\someTheme"
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
PhotoCompManagerAuthor Commented:
Alfred1..

I don't want to change the App_Themes location - it works fine for all the rest of the pages. It's just the pages in the another directory - Errors - that don't pick up the theme. These are redirected by <custom errors> in web config
0
 
Alfred A.Commented:
Is the Errors Directory a sub folder of your root website?

I have a old web site that has an Errors Folder at the same level as the App_Themes folder and the web pages in the Errors folder uses the Theme inside the App_Themes folder and it can access the theme.

By the way, the theme was set in the Page Directive part of the page source and not in code behind. I added the property Theme (eg. Theme="BlueButton") in the page directive.
0
 
Carlos VillegasConnect With a Mentor Full Stack .NET DeveloperCommented:
0
 
PhotoCompManagerAuthor Commented:
The Errors folder is at the same level as App-Themes (ie just under the root). I have set the theme in the preInit event as it can vary, but "ordinary" pages find it OK (they are just under the root, though).
0
 
Alfred A.Commented:
OK.  Out of curiosity, I tried to reproduce your situation and everything seems to be working fine.  I setup the Theme in PreInit with the ErrorPage.aspx inside an Errors folder at the same level as the App_Theme.  it works just fine.  Have you tried setting the Theme property in the Page Directive something like this:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ErrorPage.aspx.vb" Inherits="TestApp1.ErrorPage" Theme="BlueTheme1" %>

Also, if theme is available, intellisense should have pick this up.  Check the image attached and focus on the part where I was in the process of putting the Theme.  You will see that intellisense shows the available theme to use.  In the image, BlueTheme1 was seen by intellisense.
IntellisenseInPageDirectiveTheme.JPG
0
 
PhotoCompManagerAuthor Commented:
Ah, but I set in the pre-init handler in code, not the Page directive

I think I'll have to abandon the idea - it's not really worth the effort!
0
 
PhotoCompManagerAuthor Commented:
No solution
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.