SharePoint Blog

1 Comment

SharePoint 2013 – ‘HTTP 500 Internal Server Error’ while trying to browse to a SharePoint site

Users will receive an error ‘HTTP 500 Internal Server Error’ while trying to browse to a SharePoint site using Claims-based authentication.

The following error message under the event viewer on the SharePoint server

Log Name : Application

Source : Microsoft-SharePoint Products-SharePoint Foundation

Date : <Date and Time>

Event ID : 8305

Task Category : Claims Authentication

Level : Error


User : domain name\username

Computer : servername

Description :

An exception occurred when trying to establish endpoint for context: An error occurred loading a configuration file: Either a required impersonation level was not provided, or the provided impersonation level is invalid.


The Application pool account was missing the “Impersonate a client after authentication” user right.

We can resolve this issue by following this

1. Go to Start – Administrative tools – Local Security Policy – Local Policies – User Right Assignments – Impersonate a client after authentication properties
2. Add the Application Pool account for the site which is not working

3. Reboot the server, so the changes can take effect

4. Browse the site and it should work fine.


Leave a comment

Adding and Removing web parts programmatically in SharePoint

Here is how to add and remove web parts on a SharePoint 2010 web page.  First of all you need to know what Web and Page you want to move the web parts on.  The web is the site collection that you created for that site
Continue reading

Leave a comment

Could not load the sandbox dll from the ASP.NET project

Got the following error, when I used the SharePoint dll in an ASP.NET project. VS2010 puts the sandbox assembly into the bin folder automatically.

Could not load file or assembly ‘Microsoft.Sharepoint.Sandbox, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

To fix the error, just delete the sandbox dll from the bin folder directly, but it is just temporary solution, VS2010 will create the dll again each time you do a build.

The final solution for me is to add the following commands to the Post – build event command line of the Build Events for this project.

cd $(TargetDir)
del Microsoft.SharePoint.SandBox.dll

Leave a comment

Sharepoint WebPart Lifecycle Events

This post describes the lifecycle events of a Sharepoint Connectable WebPart wih a single ViewState backed property;

On Page Load
 1.  Constructor
 2.  OnInit
 3.  OnLoad
 4.  ConnectionConsumer method is called if web part is connectable (sets the connection providers interface in the webpart)
 5.  CreateChildControls
 6.  OnPreRender (if your web part is connectable you would typically call the connection provider here to retrieve data)
 7.  SaveViewState
 8.  Render
 9.  RenderChildren
10. RenderContents

Continue reading