SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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" "">
    <html xmlns="">
    <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?

share|improve this question

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.

share|improve this answer
Thank you :) I have followed the article… This page gets deployed to sharepoint server. But How can i make ajax POST call? – sharmila Oct 19 '12 at 5:02
I have also tried… 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 '12 at 6:40

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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