• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

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?
0
PhotoCompManager
Asked:
PhotoCompManager
  • 4
  • 3
  • 3
2 Solutions
 
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
 
Alfred A.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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 VillegasFull 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

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now