I am working with sharepoint sandbox solution in which I have added visual webpart(sandboxed). My requirement is to add a normal .aspx page to the project and deploy to sharepoint. I have followed the table below.

  • Add Module to project and given path of site style library

  • rename sample.txt to sample.aspx

  • and in source page of aspx page I have written general html code like below

    <%@ Page Language="C#" AutoEventWireup="true" Inherits="sample" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <form id="form1" runat="server">

In the code above sample is the class name. I have added a class file with the name of sample.cs.

I deploy the solution to sharepoint. But accessing the file sample.aspx from the url by navigating to style library will give error.

Can anyone suggest me how can I deploy .aspx pages to sharepoint using sandboxed solution?

2 Answers 2


You'll not be able to add code behind to an Site Page in a sandboxed solution. So you have to create your page as a web part page with webpartzone(s) and add your code in web parts.

  • Thank you :) I have followed the article akruratechnologies.com/2012/05/14/… This page gets deployed to sharepoint server. But How can i make ajax POST call?
    – sharmila
    Oct 19, 2012 at 5:02
  • I have also tried akruratechnologies.com/2012/05/14/… method..I have deployed a page called MyPage.aspx. and I have added a class file called MyPage.cs. But the ajax POST call is not calling the methods in MyPage.cs ..any idea where have i gone wrong?
    – sharmila
    Oct 19, 2012 at 6:40

Create a webpart page and embed a webpart into it using elements xml file :

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.