To the moderator - Please edit as you wish before posting // I have found a fundamental coding bug with PortalCSVS. The 'SaveSiteSettings' method in the 'configuration' class may cause the 'sitesettings' in the 'SiteConfiguration' object to be evicted from
the cache before all of the 'sitesettings' changes are recorded. On a number of occassions this method is called before all of the changes are written to the 'SiteConfiguration' object. Example 1 - EditImage.aspx.cs Line 1 config.UpdateModuleSetting(moduleId,
"src", Src.Text); Line 2 config.UpdateModuleSetting(moduleId, "height", Height.Text); Line 3 config.UpdateModuleSetting(moduleId, "width", Width.Text); In this example only line one can execute correctly because 'config.UpdateModuleSetting' calls the 'SaveSiteSettings'
method which evicts the 'Site Configuration' Object from the cache which means that further references to the object call the 'GetSiteSettings()' method which disregards any dynamic changes that could have been made to the parameters in Line 2 or Line 3. Hence
when Line 2 executes it simply writes values that are Loaded by the 'GetSiteSettings()' method after Line 1 has executed, instead of the dynamically changed values from the web UI. To confirm this behaviour add a breakpoint to the line if(siteSettings == null)
of the 'SaveSiteSettings' method. Add breakpoints to Line 1, 2 and 3 from EditImage.aspx.cs. You will see that after Line 1 has executed if(siteSettings == null) evaluates to True causing the 'GetSiteSettings()' method to be called. NOT GOOD if all of the
dynamic changes haven't been written to 'Site Configuration' Object. IT GETS WORSE - Example 2 - TabLayout.aspx.cs Line 1 // resave the order Line 2 Configuration config = new Configuration(); Line 3 foreach (ModuleItem item in modules) Line 5 { Line 6 config.UpdateModuleOrder(item.ModuleId,
item.ModuleOrder, pane); Line 7 } In this example the 'UpdateModuleOrder' calls the 'SaveSiteSettings' method hence the cache is cleared and the 'Site Configuration' Object is reset by the 'GetSiteSettings()' method after the FIRST round of the foreach loop.
I have added an extra bool parameter to the 'UpdateModuleOrder' method and UpdateModuleSetting and programatically decided, before the methods are called, when the 'SaveSiteSettings' method should be called. NOTE - After adding the bool parameter compilation
errors will let you know where the methods are called from so you can rewrite your code, setting the bool, to suit the situation. As far as I have determined this issue only affects TabLayout.aspx.cs and EditImage.aspx.cs. If you would like a copy of my precise
solution then please request via email. Incidently this post resolves the issues described in my two previous posts. BUG - EditImage.aspx.cs Bug - TabLayout.aspx.cs // You may wish to post this twice - As a response to each of the previous post. Either way
- your choice.
hi, you seem to have a good grasp of the problem. i think this must be the same issue which is stopping the admin page from re-ordering the tabs and modules. it's a real PITA and makes the portal look amateur to the clients. would it be possible for you to
alter the code at http://www.gotdotnet.com/workspaces/workspace.aspx?id=08333727-90b4-4caf-9400-32d92f6d2ef7 workspace name - portal starter kit part deux. you will have to sign in first but i'm sure cflat will join you up when he sees a bug fix coming in!
basically - we want to fix all the bugs in the PSK so that it can be used commercially - and add on useful extra stuff. if not could you email me a copy of your fixes and i'll try to add them - but i haven't used c# at all so it might take me a while. kbailey@freewayprojects.com
thanks - kev
That's strange because the siteSettings in the Cache are supposed to be dependent on changes to the XML file. So it should have updated it three times. I don't think I ever checked that.... HttpContext.Current.Cache.Insert("SiteSettings", siteSettings, new
CacheDependency(configFile)); Strange. The problem will be solved with moving the SiteSettings (which includes module settings) to the SQL Server tables.
Moving the SiteSettings to tables serves to increase transactional traffic to the server and COMPLETELY bypasses the functionallity available by using the XML if the site is coded correctly. While performance decreases (using SQL tables) would be ever so mild
we wouldn't want to move into a 'Cold fussion' resource PIG situation.
Is there much of a performace issue between reading the data from the XML file versus reading it from SQL Server? I wouldn't think so... but I don't know ??? And the save function for the (for example) image module would handle the update in one call to the
update stored procedure, not the three calls to update the XML file. Then the call to GetSiteSettings would return all of the data again. That, again, brings up the issue of XML vs SQL Server performance. Would it be better to have the site settings read from
the XML file AND SQL Server, or read all of the settings from SQL Server alone using stored procedures? This is an interesting issue. Is there information on the performace hits one way or the other? And as far as the TabLayout goes. I have written a stored
procedure that sorts the tabs with the new value for the tab in question. That was how I eliminated the sort tabs bug. My guess would be that running a compiled stored procedure would be faster than accessing and writting to an XML file. Especially an XML
file that may be in use by many other users. But again, I don't know for sure. Can anyone supply more information on this?
The modified save functionality only calls the GetSiteSettings module once regardless of the number of resorting functions to perform. In essence the issue of not saving changes was caused by the over zelous use of the GetSiteSettings method. As for the actual
performance difference between writing to the xml file and using a compiled stored procedure - This functionality is only used to change the layout, look and feel of the site and demonstrates how to use the xml file (all be it not very well). If someone wants
to change their website frequently enough for the performance hit to make an impact, they should probably try ridalin and lay off the caffiene.
--------------------8<---------------------------- As for the actual performance difference between writing to the xml file and using a compiled stored procedure - This functionality is only used to change the layout, look and feel of the site and demonstrates
how to use the xml file (all be it not very well). If someone wants to change their website frequently enough for the performance hit to make an impact, they should probably try ridalin and lay off the caffiene. --------------------8<----------------------------
agreed - only one point to add - isn't the data structure in the XML file useful to keep - and a bit messy to replicate in DB tables. also - do we know the full extent of the data which might be put into the XML file - i.e. is the schema anywhere so that we
can be sure that the SQL tables are ready for any data thrown at it. kev
"they should probably try ridalin and lay off the caffiene" That's funny. I thought about not removing it as well or using an XML file for something else because of the fact that it shows how to use it. The reason I have removed it in the past is because a
client tried to manually modify it, and tweaked it beyond repair. But again, we're not trying to make this a commercial app, just a better working version of the original. !!!!! Now I'm swayed torward leaving it ther and just working on the known 'out of the
box' issues. !!!!! Kev - check the xsd file for the schema. And as far as reading the data from the xml and putting in the database, read the schema from the xml to a data set, then read the data itself. Then you can go through the tables property and read
the table names. DataSet ds = new DataSet(); ds.ReadXmlSchema(xmlFilePath); ds.ReadXml(xmlFilePath, XmlReadMode.ReadSchema); foreach( DataRow dr in tbl.Rows ) { ... } For some reason just calling ds.ReadXml(xmlFilePath, XmlReadMode.ReadSchema); alone didn't
give me the table names.
Hi,I have the same problem in XML module.(In EditXml.aspx page) Xsl source never updated although the xml file name can be updated because of the reason that you explained in your post. I would be very glad if you can send me a copy of your solutions. Thanks
for your help. tufankaskavalci@yahoo.com
hi there, I'm aware this is an old post but if you still have the code for your fix please forward to me at
ayassine1@msn.com , if you have it in vb would be much appreciated .
None
0 Points
6 Posts
BUG - Portal doesn't update Admin changes correctly
Feb 18, 2005 02:43 AM|A Small Rodent|LINK
None
0 Points
5 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 08, 2005 02:20 AM|daiski|LINK
None
0 Points
26 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 08, 2005 05:25 AM|bailey86|LINK
None
0 Points
5 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 08, 2005 06:23 AM|daiski|LINK
None
0 Points
21 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 08, 2005 10:06 AM|harley_dude|LINK
None
0 Points
79 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 08, 2005 12:02 PM|C-Flat|LINK
None
0 Points
6 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 09, 2005 12:18 AM|A Small Rodent|LINK
None
0 Points
6 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 09, 2005 12:19 AM|A Small Rodent|LINK
None
0 Points
79 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 09, 2005 12:55 AM|C-Flat|LINK
None
0 Points
6 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 09, 2005 02:10 AM|A Small Rodent|LINK
None
0 Points
26 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 09, 2005 06:59 AM|bailey86|LINK
None
0 Points
79 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Mar 09, 2005 08:38 AM|C-Flat|LINK
None
0 Points
1 Post
Re: BUG - Portal doesn't update Admin changes correctly
Mar 23, 2005 04:26 AM|tkaskavalci|LINK
None
0 Points
1 Post
Re: BUG - Portal doesn't update Admin changes correctly
Apr 07, 2005 11:23 AM|manson|LINK
None
0 Points
1 Post
Re: BUG - Portal doesn't update Admin changes correctly
Sep 30, 2005 04:19 AM|ar1ndra|LINK
much appreciated.
ar1ndra@yahoo.com
None
0 Points
5 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Oct 05, 2005 11:42 AM|fiddler21|LINK
Thanks
None
0 Points
2 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Oct 28, 2005 02:23 AM|Geacher|LINK
much appreciated, too.
keppxyo@yahoo.com.tw
None
0 Points
15 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Nov 17, 2005 05:02 PM|coldpack|LINK
c.cabrales@verizon.net
thank you very much
None
0 Points
2 Posts
Re: BUG - Portal doesn't update Admin changes correctly
Feb 17, 2009 02:46 PM|ayassine1|LINK
hi there, I'm aware this is an old post but if you still have the code for your fix please forward to me at ayassine1@msn.com , if you have it in vb would be much appreciated .
Thanks