I need to store two URLs in a web-scoped feature. The reason for this is that my solution is deployed unto two different sites and I want to use these properties for storing the urls of these sites so I can access them easily from my two sites.

However, it turns out I cannot set webapp properties in a web-scoped feature, which makes insanely good sense. But that also takes away my only possible solution for this problem. So does anyone know of a place in SharePoint that can be used to store "global" variables?


In properly configured farm, Web Application properties can't be set when activating site/web feature from UI. They are stored in config database and web application's application pool is usually configured to use account without write access to it, so even SPSecurity.RunWithElevatedPrivileges() doesn't help. As adding these permissions to application pool account is not good idea, you should choose another approach.

One option is to activate feature as farm administrator using PowerShell. This way you can bypass application pool account restrictions. Another possible solution is to store these properties in root site collection (or another site collection designated for common configuration). Then if you want, you can use standard list instead of properties.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.