I want to add a code behind file to check the user's group. But I cannot find the code behind file for home.aspx. How can I create one?

1 Answer 1


.cs file types are not visible for SharePoint pages/pagelayouts.

In order for you to add your own to one of the Out-of-the-box pages like Home.aspx you'll have to

  • Create a new .cs file in Visual Studio which derives from either Page or WebPartPage


public class MyCustomCodeBehindForHomeAspx : Page
  • Then you have to open Home.aspx in e.g. SharePoint Designer and add the fully qualified name


<%@ Page 
    Inherits="MyNamspace.MyCustomCodeBehindForHomeAspx, fully qualified assembly name here"
  • Do I have to write "MyNamspace" or the namespace my .cs file is in? @Daniel Ziga
    – A Beginner
    Commented Apr 21, 2015 at 9:05
  • @ABeginner Namespace of your .cs file
    – user2536
    Commented Apr 21, 2015 at 9:08
  • It is throwing me this error : Could not load the assembly '$SharePoint.Project.AssemblyFullName$'. Make sure that it is compiled before accessing the page. @Daniel Ziga
    – A Beginner
    Commented Apr 21, 2015 at 10:16
  • Replace $SharePoint.Project.AssemblyFullName$ with your dll's info
    – user2536
    Commented Apr 21, 2015 at 10:43
  • On using gacutil command it says 0 items exist in global assembly cache for mynameapace
    – A Beginner
    Commented Apr 21, 2015 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.