Receiving error of "The type or namespace name 'LayoutsPageBase' could not be found"

asp.net, c#, sharepoint, sharepoint-2013, visual-studio-2012

Solution

You can check whether or not a SharePoint project is Sandboxed by right clicking the project in Solution Explorer and viewing the properies.

There is a true/false property called `Sandboxed Solution`.

Problem

To give you entire perspective, I am trying to create a custom ribbon in SharePoint. For that I am following this tutorial. I created the required feature and was able to deploy and test it with simple JavaScript alert. Now I am trying to call an ASPX page on click of ribbon button. For that I created an Application Page in my project. But in the code behind file of ASP.NET page I get the following error: ``` The type or namespace name 'LayoutsPageBase' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Documents\Visual Studio 2012\Projects\CustomRibbonButton\CustomRibbonButton\Layouts\CustomRibbonButton\ApplicationPage1.aspx.cs ``` I have imported (I hope thats what you call it in C#) `Microsoft.SharePoint.WebControls` with statement `using Microsoft.SharePoint.WebControls;` From this question on StackOverflow I was able to figure that `LayoutsPageBase` class is not available in sandbox solutions (with path as `\UserCode\assemblies`). So in my project I went to `References > Microsoft.SharePoint`, right-clicked on it to view its Properties. Its `Path` in Properties window is shown as `C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.dll`. What can be the reason for this error and how can it be solved?

Original source

Related problems