Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Probably a question with an obvious answer, but I'm lost. How do you add a custom aspx page (with code behind) to a project in visual studio 2008 for sharepoint 2007.

I've created the project using wspbuilder and have added a feature with receiver and other custom classes, but I find no way to add a custom aspx.net page.

Any help?

ps. once I've added it, what will be the url of it?

thanks

Edit: I've created the folder structure suggested, but I can't find a Web Form in the list of items I can add to that folder. I've created the project as a WSPBuilder project. How can I install my missing templates

Edit2: Ok adding a new guid to the ProjectTypeGuids in the .csproj file I was able to add an aspx page at 12/template/layouts/UFeature/test.aspx

    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
    <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Page Language="C#"%>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    public static string output;
    protected void Page_Load(object sender, EventArgs e)
    {
        SPUser user;
        output = "Ciao";
    }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        Prova
        <%=output%>
        </div>
        </form>
    </body>
    </html>

Now my problem is that it doesn't find SPUser even thought I've added the import of Microsoft.Sharepoint.

share|improve this question
add comment

1 Answer

You need to create the directory structure in your solution for WSPBuilder to package & deploy it correctly.

The structure will be something like:

12\TEMPLATE\LAYOUTS\MyProjectName\

Once you've got that, you can create new ASP.NET Web Forms in that folder, and they'll be deployed with the WSP.

The URL to access them will be something like

http://myserver/sites/mywebsite/_layouts/MyProjectName/MyNewAppPage.aspx

share|improve this answer
    
I can't find a Web Form in the list of items I can add to that folder –  MaurizioPz Aug 22 '12 at 6:58
    
@MaurizioPz Try installing the CKSDev extention for VS, then it should appear. –  Daniel Ziga Aug 22 '12 at 7:24
    
@Dandroid it seems to be for visual studio 2010, I'm on VS 2008 –  MaurizioPz Aug 22 '12 at 7:44
add comment

Your Answer

 
discard

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.