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.

1 Comment

ASP.NET Page Events Lifecycle – When Using Masterpages!

Found this article over on the asp.net web logs blogs!  Original article is here

  1. Page.OnPreInit
  2. MasterPageControl.OnInit (for each control on the master page)
  3. Control.OnInit (for each contol on the page)
  4. MasterPage.OnInit
  5. Page.OnInit
  6. Page.OnInitComplete
  7. Page.OnPreLoad
  8. Page.OnLoad
  9. MasterPage.OnLoad
  10. MasterPageControl.OnLoad (for each control on the master page)
  11. Control.OnLoad (for each contol on the page)
  12. Page.OnXXX (control event)
  13. MasterPage.OnBubbleEvent
  14. Page.OnBubbleEvent
  15. Page.OnLoadComplete
  16. Page.OnPreRender
  17. MasterPage.OnPreRender
  18. MasterPageControl.OnPreRender (for each control on the master page)
  19. Control.OnPreRender (for each contol on the page)
  20. Page.OnPreRenderComplete
  21. MasterPageControl.SaveControlState (for each control on the master page)
  22. Control.SaveControlState (for each contol on the page)
  23. Page.SaveViewState
  24. Page.SavePageStateToPersistenceMedium
  25. Page.OnSaveStateComplete
  26. MasterPageControl.OnUnload (for each control on the master page)
  27. Control.OnUnload (for each contol on the page)
  28. MasterPage.OnUnload
  29. Page.OnUnload

No Comments

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";

No Comments