Archive for March, 2009
The Path ‘/AppName/App_GlobalResources’ maps to a directory outside this application, which is not supported.
I recently had a crazy problem on one of my asp.net 2 projects which had previously been working for ages. I had recently had to change my localhost site root in IIS on my local dev box to another projects root to make some 3rd party site run, as it refused to run unless it was at the root of IIS.
So, once finished, I reverted the my default site’s home directory back to C:\inetpub\wwwroot\ to continue work on other projects.
When i returned to work on one of my older projects which ran in a sub folder under my local machines IIS root, i was hit with a random error;
Server Error in ‘/SharedCheckout’ Application.
The path ‘/SharedCheckout/App_GlobalResources’ maps to a directory outside this application, which is not supported.
Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.Exception Details: System.Web.HttpException:
The path ‘/SharedCheckout/App_GlobalResources’ maps to a directory outside
this application, which is not supported.
I was particularly confused by this because I hadn’t added the special App_GlobalResources directory to my project through visual studio. Anyway after a bit of googling I found this to be due to IIS being completely confused by the extra trailing \ when defining the home directory for my site definition- so i changed it to C:\inetpub\wwwroot (removing the trailing \) and everything was back to normal.
ASP.NET Page Events Lifecycle – When Using Masterpages!
Posted by in .net on March 8th, 2009
Found this article over on the asp.net web logs blogs! Original article is here
- Page.OnPreInit
- MasterPageControl.OnInit (for each control on the master page)
- Control.OnInit (for each contol on the page)
- MasterPage.OnInit
- Page.OnInit
- Page.OnInitComplete
- Page.OnPreLoad
- Page.OnLoad
- MasterPage.OnLoad
- MasterPageControl.OnLoad (for each control on the master page)
- Control.OnLoad (for each contol on the page)
- Page.OnXXX (control event)
- MasterPage.OnBubbleEvent
- Page.OnBubbleEvent
- Page.OnLoadComplete
- Page.OnPreRender
- MasterPage.OnPreRender
- MasterPageControl.OnPreRender (for each control on the master page)
- Control.OnPreRender (for each contol on the page)
- Page.OnPreRenderComplete
- MasterPageControl.SaveControlState (for each control on the master page)
- Control.SaveControlState (for each contol on the page)
- Page.SaveViewState
- Page.SavePageStateToPersistenceMedium
- Page.OnSaveStateComplete
- MasterPageControl.OnUnload (for each control on the master page)
- Control.OnUnload (for each contol on the page)
- MasterPage.OnUnload
- Page.OnUnload
SessionId re-generated on each page hit
If the session is not used at all on a page then the sessionId will get trashed. To maintain the same sessionId, when you have pages which don’t use the session, you just have to add some kind of call
protected void Page_PreInit(object sender, EventArgs e)
{
//Need this line otherwise it resets the Session Id everytime!
Session["keepme"] = "True";