I had a problem this morning, with a custom control that I am using in PublishingPages and admin pages in the _layouts folder.
The control looks for some custom properties in the current pages ParentFolder. However when checking the SPFile.ParentFolder.Item property in a page located in _layouts it throws an exception - "The object specified does not belong to a list".
My first thought was to check for SPFile.ParentFolder.Item != null, but that didn't work. However by setting a break point I discoverd that folders in the _layouts directory don't exist!
So use: if(SPFolder.Exists) {}
Showing posts with label WSS v3. Show all posts
Showing posts with label WSS v3. Show all posts
31.7.07
WSS coding best practice
This article is a must read: http://msdn2.microsoft.com/en-us/library/ms778813.aspx
I've been having a few memory problems lately in the project im currently working on. I thought I was correctly disposing of all my SPWeb and SPSite objects but I didn't realise that even accessing SPFolder.ParentWeb would create a new instance if one wasn't available.
I've been having a few memory problems lately in the project im currently working on. I thought I was correctly disposing of all my SPWeb and SPSite objects but I didn't realise that even accessing SPFolder.ParentWeb would create a new instance if one wasn't available.
Subscribe to:
Posts (Atom)