What is the difference between SPContext.Current.Web and SPContext.Current.Site.OpenWeb()?

Alexey Krasheninnikov
  • What is the difference between SPContext.Current.Web and SPContext.Current.Site.OpenWeb()? Alexey Krasheninnikov

    My colleague found that some scenarios of working with SPWeb objects depend on how you obtain them. I'm not talking of impersonating with UserTokens - that another story. But at times when you write web parts, you get some extra security constraints with SPContext.Current.Web that you don't suffer from with SPContext.Current.Site.OpenWeb().

    Does anyone have any further technical guidance on the topic?

Tags
2007 development security
Related questions and answers
  • SharePoint Server 2010 is a fantastic product! However, I'm sure you have some great ideas for v.Next. What features do you believe could be improved for SharePoint 15? One topic per answer please (you can leave multiple answers) so the community can vote. (Question inspired by Project 15 Wish List post.)

  • I have a problem happening on IE only when you put some name or add some name to the people picker. It will then validate and display users side by side. I think SharePoint injects the users using JavaScript. Then the problem comes out of nowhere, a table (or div maybe) appearing like the attached image. Also, its resizeable. SCREENSHOT http://img17.imageshack.us/img17/1613/sssrq.jpg

  • A client is asking for a custom application to be created and deployed within the corporate intranet. Part of the requirements are to publish some of the content also available on the internet site. Both sites are built on SharePoint 2007 but they are on different farms and on different networks. Can the Content Deployment API (and associated tools) handle moving selected content across networks with no direct connectivity? Can we use web services? Has anybody done this sort of thing? If so what approaches have you taken? Thanks, James.

  • I have a list, with a list item that contains an attachment. I was horrified to see that the link to the attachment doesn't work if the attachment file name contains a space. I'm amazed that SharePoint will even allow you to store file names with spaces, if it doesn't know how to handle them correctly. Is there some kind of server setting that you can set to "Handle attachment file name spaces" correctly? Or is this a known limitation with Sharepoint? If yes, please tell me this issue is fixed in 2010? Update I've narrowed it down to " +" in the filename a space directly followed

  • I think I found a bug. Please share if you know more about it. I use GetListItems operation to fetch items to display on an ajaxified form. Just an hour ago everything was fine, but now when I query the list with <Eq><FieldRef Name='Some/Field'><Value Type='Lookup'>Value</Value></Eq> The relevant items show up in the result set. But the values for 'Some/Field' (yes there is a slash in the displayname) are displayed as null. The field was never renamed. What is it? How can I fix?

  • . At the moment the following databases have priority, but as we only have a limited set of services enabled I know there are many more. SharePoint_AdminContent_[some guid] Managed Metadata Service_[some guid] Search_Service_Application_CrawlStoreDB_[some guid] Search_Service_Application_DB_[some guid] Search_Service_Application_PropertyStoreDB_[some guid] User Profile Service Application_ProfileDB_[some guid] User Profile Service Application_SocialDB_[some guid] User Profile Service Application_SyncDB_[some guid] WordAutomationServices_[some guid] WSS_UsageApplication Update: If you have

  • I've created a Silverlight webpart. It's shown on a SharePoint page on which there are also some links which trigger SharePoint popups, actually the Silverlight web part triggers one itself. Now when the popup is displayed, the rest of SharePoint is grayed out; except for the Silverlight control! It stays active, and worse; when you click it, it comes up in front of the SharePoint popup effectively making it impossible to close that popup. Is there a way to get around this? I assume it's a bug?

  • I'm some kind of admin on my sharepoint site, but not the big kahuna who runs it all. I can add users and groups and set permissions within my site. What I can't figure out how to do is actually make a user a member, so that when they use the My Links dropdown, they'll be able to see the sites I run as one of the options (that arise from the My SharePoint Sites option). How do you make, and in fact even tell that a user is a member (in 2007)?

  • that does the approval. Ideally, they could see the information in one webpage, approve or reject it, write a comment explaining why it was approved or rejected and then click some sort of submit button... to the approver doesn't seem to be editable or have the option of being disabled (I don't want them to have a link to the XML for simplicity sake) The link from the "You have been assigned as task" email is small and does not take you directly to the page where you can click "Complete Task" (you have to click Edit Item from the linked page) The data and approval form are separated Simplicity is key

Data information