i have created a provisioning wizard to control where and what sites are created. I do this through a web part that is added to the STS#1 definition. To prevent users from accessing the site settings menu everyone is setup at the top level as a "Reader". So obviously if i want to create a site, within the users context, i need to elevate their permission. There is plenty of code out there that demostrates the SPSecurity.RunWithElevatedPrivileges, however, if you are to use the SPContext while inside a call to RunWithElevatedPrivileges it does not elevate the current context permission. You will have to open a new site. Examples below:
// Doesn't Work
SPSecurity.RunWithElevatedPrivileges(delegate {
using (SPWeb web = SPContext.Current.Web) {
// provision site & do other jazz
web.Webs.Add(...);
}
});
// Better
SPSecurity.RunWithElevatedPrivileges(delegate {
using (SPSite site = new SPSite(SPContext.Current.Web.Url)) {
using (SPWeb web = site.OpenWeb()) {
// provision site & do other jazz
web.Webs.Add(...);
}
}
});
Odd but works for me.
Tuesday, October 16, 2007
Monday, October 01, 2007
Extinction of Languages: Bad thing?
I was reading this article on Slashdot and they make it seem like this is a bad thing. I think this is a good thing. While the languages are gone, the cultures are still there. With the benefit of being able to communicate now with a greater number of people. I consider a language to be a standard, a standard in which people communicate. As with any standard, they arise from necessity. With technology bridge geographical communication obstacles, there is a boarder range of communication and essentially new standards--which may render older standards obsolete. If this wasn’t the case, we would never make any progress. How’s the old saying, “Out with the old, In with the new”.
Monday, January 29, 2007
_layout directory: Page cannot be Found.
After making changes to the web.config file through IIS and the ASP.NET 2.0 Application Configuration utility, any aspx page that resides in the _layouts virtual directory returns a "Page cannot be Found" error. Apparently the configuration utility hard codes the v2.0 schema to the configuration segment. ASP.NET reads in the xml with the particular schema...ignores the v3.0 (Sharepoint stuff) and breaks the application. Simply removing the (xmlns=”http://schemas.microsoft.com/.NetConfiguration/v2.0") from the segment cures the problem.
Simple fix--forever to find!
Simple fix--forever to find!
Subscribe to:
Posts (Atom)