Penny0821

Hi

when i create a project use the vs2005 and add the sharepoint reference.In the project i add a new page,I build it and send the aspx file to the layout folder and copy the dll to the virtual path. when there is no source code in the page,i can type the url and visit the page corectly but then add some source code like

SPSite mySite = new SPSite("http://ncs-mal:20000/default.aspx");

it show me a error message

Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

but if i copy the same source code in a windows application on the server and it can work correctly

who can help me




Re: SharePoint - Design and Customization Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=1

AshishKSrivastava

I get the same error

Error: Microsoft.SharePoint - Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

but I have a different scenario. I have created a custom webservice for sharepoint webservices. I am using this web service in my sample web application with the following code:

try

{

wb1_128.SPWS oUploader = new wb1_128.SPWS();

oUploader.PreAuthenticate = true;

oUploader.Credentials = CredentialCache.DefaultCredentials;

string strPath = @"C:\inetpub\wwwroot\SharePointClient\test.doc";// APNET user has access to this folder

string strFile = strPath.Substring(strPath.LastIndexOf("\\") + 1);

string strDestination = "http://wb1-128/CarizmaSharePointPortal/Carizma%20Documents/";

FileStream fStream = new FileStream(strPath, System.IO.FileMode.Open);

byte[] binFile = new byte[(int)fStream.Length];

fStream.Read(binFile, 0, (int)fStream.Length);

fStream.Close();

string str = oUploader.UploadDocument(strFile, binFile, strDestination);

Response.Write(str);

}

catch (Exception ex)

{

Response.Write(ex.Source + " - " + ex.Message + " - " + ex.InnerException + " - " + ex.StackTrace);

}

Could someone from Microsoft pick up this thread please and reply me. Its urgent and already have spent huge time on Windows Sharepoint services 2.0 bugs.

Ashish





Re: SharePoint - Design and Customization Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=1

zero.xiong

I got the same error too. I need help.




Re: SharePoint - Design and Customization Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=1


Re: SharePoint - Design and Customization Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=1

Ehab Zaghmout

' i'm trying to create an item in SPList abd adding items to it, This is my code:

Protected Sub btSubmit_click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Try

SPSecurity.RunWithElevatedPrivileges(AddressOf addItems)

Catch ex As Exception

Page.Response.Write(ex.Message)

End Try

End Sub

Public Sub addItems()

Dim site As SPSite = SPControl.GetContextSite(Context)

Dim web As SPWeb = site.RootWeb

Dim list As SPList = web.Lists("MY_LIST_NAME")

Dim item As SPListItem

web.AllowUnsafeUpdates = True

web.Update()

Dim items As SPListItemCollection = list.Items

item = items.Add()

'''''''''''''''''''''text fields'''''''''''''''''

item("COL1") = "COL1"

item("COL2") = "COL2"

item("COL3") = "COL2"

item("COL4") = "COL2"

item("COL5") = "COL2"

item.Update()

web.AllowUnsafeUpdates = False

End Sub

' But i got this error:

' Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, ' Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

' IS THERE A WAY TO GET RID OF IT





Re: SharePoint - Design and Customization Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=1

Tedley

By default WSS/MOSS is configured with a security policy called WSS_Minimal. This policy definition doesn't grant access to the SP object model.

The simplest approach to enable access is to modify the web.config file in the virtual directory root for your site and change the following tag

<trust level="WSS_Minimal" originUrl="" />

to

<trust level="WSS_Medium" originUrl="" />

The difference between Minimal and Medium is the addition of SharePoint object-model access and access to the NT event log.