Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Developeing SharePoint web parts problem

Developeing SharePoint web parts problem

Scheduled Pinned Locked Moved C#
helpsharepointsecurityquestionannouncement
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dratcha
    wrote on last edited by
    #1

    I started developing a web part but am having some security issues with it. I am trying to do some really simple stuff as shown below. SPWeb mySite = SPControl.GetContextWeb(Context); output.WriteLine(SPEncode.HtmlEncode(mySite.Users.Count.ToString())); It is the SPWeb line that is giving me the security error which is: Request for the permission of type Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c failed. I started by making the webpart safe in the wss_minimaltrust.config file by using the Public key. That didn't work so I upgraded the trust level to Medium in the web.config file just to see what would happen. it still broke so I upgraded the trust level to Full. It still broke! This code is used by many others all over the web but I haven't seen them having any issues. Full trust should allow everything so why am I still getting a security error? Oh, and I did iisreset between each security change just to be sure it took hold. Thanks for any help!

    D 1 Reply Last reply
    0
    • D dratcha

      I started developing a web part but am having some security issues with it. I am trying to do some really simple stuff as shown below. SPWeb mySite = SPControl.GetContextWeb(Context); output.WriteLine(SPEncode.HtmlEncode(mySite.Users.Count.ToString())); It is the SPWeb line that is giving me the security error which is: Request for the permission of type Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c failed. I started by making the webpart safe in the wss_minimaltrust.config file by using the Public key. That didn't work so I upgraded the trust level to Medium in the web.config file just to see what would happen. it still broke so I upgraded the trust level to Full. It still broke! This code is used by many others all over the web but I haven't seen them having any issues. Full trust should allow everything so why am I still getting a security error? Oh, and I did iisreset between each security change just to be sure it took hold. Thanks for any help!

      D Offline
      D Offline
      dratcha
      wrote on last edited by
      #2

      Ok, so duh... I was editing the web.config located in Program Files\Common Files\Microsoft Shared\web server extensions\60\CONFIG when the web.config that needs to be edited is in the web root under Inetpub.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups