In web.config change the following:
1. CallStack="false"
2. <customErrors mode="On" />
Now refresh the page to see the actual ASP.NET error message.
Before:

After:



<asp:content contentplaceholderid="PlaceHolderLeftNavBar" id="Content2" runat="server">
<sharepoint:spsecuritytrimmedcontrol permissionsstring="ManageWeb" runat="server">
All the divs and HTML for the menu goes here.
</sharepoint:spsecuritytrimmedcontrol>
</asp:content>
Today my manager came up with the requirement that Recycle Bin Link in Quick Launch Menu should be visible to Administrator only.
If it was the case for a webpart then I could easily specify the Target Audience and voila. But unfortunately webpart zone is not available for Quick Launch Menu and I didn’t want to write custom menu just to hide the RecycleBin link so the genius came up with the following dirty trick. (Yes, I have recognized myself as a genius since childhood).
1. Launch the SharePoint Designer.
2. Navigate to _catalogs -> masterpage -> default.master.
3. Create a backup of the master page file and open original for editing.
4. Scroll down till the bottom and paste the following javascript code right before </Body> Tag:
var UserID = document.getElementById('zz8_Menu').innerHTML;
UserID = UserID.split('<')[0]; UserID = UserID.split('\\')[1]; if (UserID != 'Administrator') { //Hide Recyclebin var objRecycleBin = document.getElementById('ctl00_PlaceHolderLeftNavBar_idNavLinkRecycleBin'); if (objRecycleBin) { objRecycleBin.style.display = 'none'; } }
5. Save and it should hide Recyclebin for all users except for the administrator.
Note: Please check for the Ids ctl00_PlaceHolderLeftNavBar_idNavLinkRecycleBin and zz8_Menu by view source.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace SPListEvents
{
public class CandidateListHandler: SPItemEventReceiver
{
public override void ItemAdded(SPItemEventProperties properties)
{
try
{
SPListItem item = properties.ListItem;
item["Status"] = "Added";
item["Company"] = "Company1";
item.Update();
}
catch (Exception exp)
{
//do something with exp
}
finally
{
base.ItemAdded(properties);
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.SharePoint;
namespace InstallSPEventHandler
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SPSite site = new SPSite("http://mysite.com:1100");
SPWeb web = site.OpenWeb();
SPList survey = web.Lists["Candidates"];
string assemblyName = "SPListEvents, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd22d2b1bc79915b";
string className = "SPListEvents.CandidateListHandler";
survey.EventReceivers.Add(SPEventReceiverType.ItemAdded, assemblyName, className);
//survey.EventReceivers.Add(SPEventReceiverType.ItemUpdated, assemblyName, className);
MessageBox.Show("Done");
}
}
}
I have recently contributed to the official SharePoint documentation for developement. Check it out here: https://docs.microsoft.com/en-us...