Re: Read-only access to SPGlobalConfig without administrator rights

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello Matt,

Well, back to the impersonation thing again. We agree you shouldn't hardcode admin user names and passwords in code, but you can have impersonation using other options. One way would be to use to application pool identity which is always a local administrator and SharePoint database administrator (it's credentials are stored safely in the IIS metabase), another approach would be to store the credentials in the SPPT credential mapping database (where it's kept encrypted). So, you have other options besides hard coding names and passwords...

Kind regards,
Nikander & Margriet Bruggeman

Does anyone know how to simply READ (not update) the settings in
SPGlobalAdmin and SPGlobalConfig without impersonation?  We need to
read the BlockedFileTypes property in SPGlobalAdmin.Config for a
custom Web Part we're building that allows file uploads.  We want to
use the BlockedFileTypes property for the upload validation code.

It is a standard Portal site with Windows integrated security.  The
users are not portal admin users, so impersonation doesn't work, and I
don't want to hard-code admin user names and passwords in code or in
web.config.

// Obtain a reference to the SharePoint admin class
SPGlobalAdmin admin = new SPGlobalAdmin();
// Test reading output << Prompts for admin logon here >>
output.write(admin.Config.BlockedFileTypes.ToString());
Thanks,

Matt




.



Relevant Pages

  • Re: Read-only access to SPGlobalConfig without administrator rights
    ... back to the impersonation thing again. ... > admin user names and passwords in code, ... One way would be to use to application pool identity ... > credentials are stored safely in the IIS metabase), ...
    (microsoft.public.sharepoint.portalserver.development)
  • XP SP2, SSPI, Bad Impersonation level Error
    ... password which allowed me to use SSPI to impersonate the admin user ... Since installing XP SP2, the SSPI impersonation code works the same ...
    (microsoft.public.platformsdk.security)
  • Read-only access to SPGlobalConfig without administrator rights
    ... SPGlobalAdmin and SPGlobalConfig without impersonation? ... BlockedFileTypes property for the upload validation code. ... users are not portal admin users, so impersonation doesn't work, and I ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Server Error in / Application - Compilation Error - Temporary ASP.NET Files
    ... I set impersonation to an admin user on the server, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Error: "Unable to connect to database" when impersonating on Sharepoint Portal
    ... There are some limitations when doing impersonation within SPPT, you could try another approach which is described in more detail on http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=7, basically, in this scenario you're using impersonation, after that you need to create a new AppDomain and have your code executed in that. ... After that you must ensure the data is marshalled back to your parent AppDomain. ... If I impersonate with the same admin user as worked fine before I now ... Dim web As SPWeb = New SPSite.OpenWeb ...
    (microsoft.public.sharepoint.portalserver.development)