CslaAuthentication in different web.config of the same web application

CslaAuthentication in different web.config of the same web application

Old forum URL: forums.lhotka.net/forums/t/2784.aspx


tqvdang posted on Thursday, April 26, 2007

Hi,

We have a main web application where web.config specifies CslaAuthentication="Windows" and opens itself as Csla Remoting Host. This web application contains a sub-folder. This sub-folder has a seperate web.config that point to different Csla Remoting Host in different server (CslaPortalUrl). Look like to me that doing so, not only my DataPortal_XYZ features called in sub-folder will be rerouted from a Remoting Host (which I expect), but also all DataPortal_XYZ features from the main web application will be pointed to Remoting Host. Is there any way that I can specify tell the web that only call coming out from that specific sub-folder will be forwarded to the different remoting host server, the rest will stay the same? Thanks alot guy.  

Best regards,

Dang Tran

RockfordLhotka replied on Thursday, April 26, 2007

The data portal configuration comes from System.Configuration.ConfigurationManager, which reads the config file. It is my understanding that the config settings are read once for the AppDomain, and the values are cached in a Dictionary from that point forward.

In other words, I think the answer is no, you can't get the behavior you want using the default data portal model.

However, you could create your own client-side data portal proxy object and make that be the proxy used by the CSLA data portal. Then your proxy object could use some other configuration scheme (because obviously System.Configuration.ConfigurationManager won't help you) to determine the URL to use when calling the app server.

tqvdang replied on Monday, May 14, 2007

Hi Rocky,

Thank you for your advice. I used a little trick, extended from your RunLocal attribute. I implemented RunRemote which help me to define a method running remotely explicitly. Also, from your advice, I modified your code to treat configuration file as regular Xml file. It works great. Yet, there is one minor thing in my RunRemote attribute. I have to pass in constant string as parameter. Attribute does not allow me to define the parameter from a variable. In other words, I have to hard coded the link inside client code. I would try to read the neccessary information from configuration file in attribute class itself instead of passing manually. Hope it will solve the issue. But by the way, thank you for your suggestion. I didn't know that ConfigurationManager cached the values. I'm so newbie.

Best regards,

Dang Tran 

Copyright (c) Marimer LLC