PDA

View Full Version : Switching between hierarchical contexts


zblock
12-09-2005, 04:19 AM
I have a web app with two web configs as described in http://forum.springframework.net/viewtopic.php?t=278. I've noticed that when I switch from the subdirectory to the parent I sometimes get invalid cast exceptions...

It think the behavior is limited to the following scenario:

I'm editing a page in my subdirectory. I make a change to the root web.config. If I reload a page in my subdirectory and navigate to a root page, I get the exception. My hunch is that what's happening is that the child context gets loaded when I refresh the child page and when I navigate to the root, the root context isn't properly loaded. In other words, if context hasn't been loaded for whatever reason, does a root page need to be loaded first?

Thanks,

-- John


[InvalidCastException: Specified cast is not valid.]
Spring.Web.DataModel.DataModelManager.get_DataMode l() +27
Spring.Web.DataModel.DataModelManager.InitializeDa taModel() +13
Spring.Web.UI.Page.OnInit(EventArgs e) +392
ESRWeb.About.OnInit(EventArgs e) in C:\Code\Clients\ESR\ESR2\ESRWeb\About.aspx.cs:45
System.Web.UI.Control.InitRecursive(Control namingContainer) +241
System.Web.UI.Page.ProcessRequestMain() +197

smhinsey
12-16-2005, 04:40 PM
I am actually encountering this same issue myself.

To be more specific, my application requires authentication and redirects to /login/login.aspx. After authentication, you're redirected back to /default.aspx, causing this error.

zblock
12-16-2005, 07:31 PM
I found a workaround by moving my login.aspx page to the root, uprotected site. This way, the root context always gets initiated first before navigating in the protected context. I'm not sure if this was the right solution, but it seems to be working...