.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

WebPart Assembly deployed to GAC is not working

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :SharePoint

I've developed a web part using WSPBuilder and created a feature to deploy it

I managed to get the web part running on my web application using WSS_Minimal trust level in Web.Config, so there is no problem with the code (Anyway I'm adding a literal control with a fixed text in CreateChildControls()).

I knew that deploying to GAC does not require setting the trust level as the assembly deployed to GAC is fully trusted by CLR but when I change the trust level to any of (Minimal/Low/Medium/High) while deploying to GAC, I get the exception

"Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed"

so why I'm getting this exception when deploying to GAC while the assembly deployed should be FULLY trusted and not requiring a specific trust level as opposed to \BIN deployment.

THosE wHo doN'T apPreCiATe LiFe,

View Complete Post

More Related Resource Links

clr assembly in sql server - working directory? and exception question

Hello, I have a small assembly in sql server 2008... it's pretty simple, but in the very rare circumstance that it may throw an exception I am catching it and writting to a log file. something like: using (StreamWriter sr = new StreamWriter(@".\ErrorLog.txt", true)) { sr.WriteLine("{0:G} ===> {1}", DateTime.Now, ex.Message); } I believe that should write the file to the working directory... 1. what would the working directory be for sql server 2008? the binn directory? 2. what would happen if a clr assembly added to sql server throws an exception that is not handled by your clr code?

SharePoint 2010 - "My Inbox"(OWA) webpart not working with Exchange 2010

Hi, I'm trying to setup the webpart "My Inbox" (OWA) in SharePoint 2010. It works when connecting to OWA running exchange 2007, but failes with error 400 not found when connecting to OWA running Exchange 2010. The error appears after logging in.  I'm using this url: https://<exchangeserver>/owa I assume that this should be supported by Exchange 2010, but it seems to fail using this parameter /?cmd=contents. Any suggestions?   Best regards, Petter

Reflection.Assembly Load Failure on GAC Deployed DLL From Layouts Directory

So, I've got the oddest thing going on with a web part project that I'm working on for our MOSS '07 server farm.I created a web part that connects to our Active Directory as a sort of company directory thing.  Permission requirements seem to be such that I have to deploy the DLL to the GAC, which I've configured my setup package (WSP Builder) to do.  Everything seems to be working just fine.Then, I add an ASPX page to the Layouts directory in the 12 hive which is supposed to display all the contact details for the domain user by accessing the same DLL that the web part uses.  However, the ASPX page can't find the DLL in the GAC.  I get the following error message in my popup window:File Not Found.   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)    at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)    at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)    at System.Reflection.Assembly.Load(String assemblyString)    at System.Web.Configuration.CompilationSection.LoadAssembly(String assemblyName, Boolean throwOnFail

Custom Webpart not working on "My Profile" page but works on all other pages. Linq Problem?

Hi, I created a publication site and in that site i created pages with specifique metadata (using a pagelayout with a custom content type)0. My webpart is getting data from those pages and displaying it. My webpart works on every page except on the "my profile" page(overview tab). I get the following error: Invalid Url: /TestSites/course I used the SPMETAL to create a class and i'm using this class to retrieve the data from the pages (with linq). The url i give to the entity is http://pcp/TestSites/course  this works fine on every site except on the my profile page. Can anybody help me? Here is the code i use to retrieve my data: EntitiesDataContext ctx = new EntitiesDataContext(courseSite); //Code below gets only the pages with a courses contentType. //EXCEPTION TRIGGERT ON THE FOLLOWING LINE IF IN PROFILE PAGE EntityList<Courses> course = ctx.GetList<Courses>("Pages"); //Writing the query to get the correct pages(with the course page layout only! var Query = from myCourse in course.ToList() where myCourse.CourseParticipants.Contains(myWeb.CurrentUser.LoginName) Select new{myTitle = myCourse.CourseTitle, myCompany = myCourse.Company, myPath = myCourse.Path, myName = myCourse.Name }; Thx.    

Possible bug: Calendar views browse month function not working when list is inserted as webpart.


Inserted a custom list with a calendar view on a page as webpart. Browse month function does not work, there is a postback but month is still the current month instead of the next or previous.

Is this a know issue/bug?

Silverlight webpart not working...



I have created a silver light Log In application  and added it into my Empty SharePoint Project. Also i created webpart for the silverlight application with the help of this link http://chrisforbesblogs.net/2010/08/11/deploying-a-silverlight-application-to-sharepoint-2010/

Now when i deployed the webpart i can see the webpart but when perform any operation i get the following error:

Microsoft JScript runtime error: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
   at MahaleLoginNew.ServiceReference1.GetPasswordCompletedEventArgs.get_Result()
   at MahaleLoginNew.MainPage.Webservice_GetPasswordCompleted(Object sender, GetPasswordCompletedEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at MahaleLoginNew.ServiceReference1.ServiceClient.OnGetPasswordCompleted(Object state)

Not getting the way to solve it......


ReportViewer webpart is not working after SharePoint 2010 upgrade


After upgrading to SharePoint 2010 and Reporting Services 2008 (separate servers), all our web part pages that have the ReportViewer web parts in them are not working.  The error we are getting is "Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe."  All the reports are working on the report server but not through the web parts.  We used Visual Studio 2005 to create these reports and they all work in MOSS 2007 that also ran Reporting Services 2005.  If we delete the web part with the error and put in the ReportViewer web part manually on the page in SharePoint 2010, the reports do work.  But there are too many reports to be doing this manually for every web part page.  We already tried making changes to the Handler Mappings but it did not resolve the errors.  As far as we can tell, all the DLLs are in the right places.  Any help or suggestions would be greatly appreciated.  Thanks.

Intellisense not working for assembly registered in global web.config


I made a custom server control library that all of our websites will be using. I have registered the dll in the global web.config of our production and development servers, and everything builds and runs fine. The only problem I have is Visual Studio/Intellisense not recognizing my control. I get the error message "Unknown server tag...", which in turn throws other validation warnings. Does anyone know how to tell Visual Studio to include dll's registered in this location?

Our sites are .net 4.0 and below is an excerpt from the web.config located in %SystemDrive%\Windows\Microsoft.NET\Framework\v4.0.30319\Config on the servers.



    <add assembly="[assembly info]" tagPrefix="irnrControls" namespace="IRNR.Controls"/>



It's not that big of a deal right now as I only have one control in the dll, but I would like to fix this before I add more controls. Thanks in advance.

Update Webpart Assembly info programmatically



We have a requirement where in we need to update all the old custom webpart which are added to the portal with new Assembly information. The way we have planned is to create a console app, iterate through all the Pages Library withing each Site and Sub-site, get the WebPart Collection and once the "SPWebpartCollection" object is created, use System.Reflection.PropertyInfo and get all the property. I am done almost uptill here, but now stuck on how to proceed further. I would like to change the WebPart Assembly and Namespace information. The reason why this is required is, earlier earlier each webparts were having different dll. Now we have clubed all the webpart under one Assembly and the namespace are kept same now. But because the webpart were added to the page manually, they are holding the reference to the old assembly. The other way would be to remove the webpart and re-add the webpart which is not very much accepted when the number of sites and sub-sites involved in more than 1500.

Any solution would be really appreciated. Thanks.

Regards, Paddy

Content Editor Webpart not working in web part page


I Have a CEWP, i have written jquery for displaying the same.It works fine when i do the following:

Site Actions --> Edit page -->Add a Webpart --> CEWP --> and in the Source control editor, i paste the jquery. My jquery does a calculation by comparing two values A and B in a list. If A is greater, one image is shown, if it is less another image will be shown.When the user clicks the image the list gets opened and on the change in the values the image will be changed. This works perfectly when i do the above.

But when i create a Webpart page, it gets created in the Shared Documents site. And when i add a web part and does the same thing, my CEWP is not showing the correct image.




RS Integrated Mode ReportViewer Webpart not working





I have setup RS in integrated mode, and i can access and view the reports by clicking on them in the SharePoint document library. However i would like to view some of the reports in webparts elsewhere on the site.  When i click to add a webpart i have the following selection of RS related webparts:


1. Report Explorer

2. Report Viewer

3. ReportViewerWebpart

4. ReportViewWebpart

5. SPExplorer

6. SPViewer

7. SQL Server Reporting Services Report Viewer


Number 2,3 and 6 all appear to be exactly the same, and in the toolpane for all 3 it asks me the URL for the report Manager and the path to the report.  The Manager no longer exists in Integrated Mode and i cant figure out therefore what i should enter here to display the report. (this worked fine to display the report when in Native Mode...)


Number 1 and 5 are a similar story.


Number 7 doesnt work at all - when i try and add the webpart it says:


"Unable to add selected webpart(s).

SQL Server Reporting Services Report Viewer:

Working with SharePoint document libraries

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

Row command working on all rows not selected one?



I have this code that hides a column in a gridview.  (The column houses another nested gridview).

    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        If e.CommandName = "Select" Then
            If GridView1.Columns(0).Visible = False Then
                GridView1.Columns(0).Visible = True
                GridView1.Columns(0).Visible = False
            End If
        End If
    End Sub

The trouble is that if I click the select link on one row that action to hide is carried out on all rows.  How can I set this up so that it only hides the row that is selected?


upload file not working



iam using masterpage and ajax update panel, i have child page called  fileupload.aspx,i try to upload the file

but its not working , can i use updatepanel in child page , pls very urgent

looking forward for answer.

JQuery Treeview plugin is not working with Ajax page load in ie8


Hi there,

I developed a page where i m using jquery treeview plugin to generate tree. It worked fine on FF, IE8 with out ajax.

But when my page loads thro' ajax call in IE8, it is not collapsing or expanding tree.

Any idea?

Thanks in advance.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend