Megosztás a következőn keresztül:


"When caching is enabled for the XmlDataSource that is control tree it requires a UniqueID that is unique throughout the application" - Use an ID for XmlDataSource

XmlDataSource class internally calls a private method called CreateCacheKey. Now, if you are using XmlDataSource without an ID, after upgrading the solution to ASP.NET 3.5, this might throw an exception - "When caching is enabled for the XmlDataSource that is not in the pages control tree it requires a UniqueID that is unique throughout the application." This is due to the absence of the UniqueID (which is read-only, but my experiment shows that setting the ID handles the same), which is used as part of the caching key, without which all instances would try to use same caching key. Setting a distinct ID solves this problem and the problem goes away.

Thanks and credits to https://forums.asp.net/p/1294664/2510357.aspx

Example.

XmlDataSource XmlSrc = new XmlDataSource();
XmlSrc.ID = "XmlSource1";

Comments