Building a simple ASP.Net page based SharePoint application in Visual Studio with the Visual Studio Extensions for WSS CTP 1.1



This is the first in a series of posts on how to build various types of applications on SharePoint.

In this post we will use Visual Studio 2005 & the Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1 CTP (VSeWSS)to build a very simple 2 page ASP.Net page based application and deploy & run it in SharePoint.

My goal/hope is that it will show regular ASP.Net developers how to start out building some of the same things they do today but on SharePoint.

SharePoint can look like a big scary black box to people looking at it for the first time.  I started out that way too, but with a little understanding on how to get things done and a little insight on how things work SharePoint is not all that scary.  At least I dont think so anyway πŸ™‚ Admittedly I am bias too πŸ™‚

Tip:  Click on the images for a better view if they are being cut off on the right.



In previous post of mine Application Development on MOSS 2007  & WSS V3 I called the technique we will use "Option 4:  Adding ASPX pages to SharePoint Site".  I documented some steps to try this method out.  However, many readers emailed me expressing problems they were having with it as it required some tricky steps.  Another problem was that it didn't package up the solution using the SharePoint Solution packaging technology (.WSP files).  That meant it was manual to deploy, and not very easy.

Based on the level of feedback I got on the original post I thought it would be worth while tidying up the technique and introducing the use of some tools that make it much easier.

VSeWSS is a toolkit we put out that helps developers build a solution to deploy to SharePoint.  There has been quite a bit of criticism of the tools and we are working hard to keep building on them to fix that.  The tools are currently version 1.1 CTP and we will be releasing the final version of that in the not too distant future.  For some more background on VSeWSS Chris O'brien has a good post: VSeWSS 1.1. CTP - a look at the nuts and bolts.


The Solution

We will create a very simple application comprised of 2 pages that allow a user to type a string into a text box, press a button & have what they typed displayed on a different ASP.Net page.  As I said ... very simple. 

The point here is not to build out a super complex application, but show a method that you can use to build this kind of application.

Full source for this solution can be found here:



The first thing to do is make sure you have VS 2005 & VSeWSS installed from the link above on a machine that has WSS V3 installed & configured.  You should be able to navigate to http://<your server name>/ and see a WSS site.  Make sure you can do this first, before moving on.

For help with installing WSS see: Install Windows SharePoint Services 3.0 on a stand-alone computer


1. Create the project

First up create a new blank VSeWSS project.

File -> New -> Project

Choose the "Empty" template and call it "DataEntryApp".  This will create a new VSeWSS blank project for us.



Your Solution Explorer should now look like this



Now add the following references to your project


Now you have created the skeleton of the project we are ready to move on and start creating the pages & code that make up the solution.


2. Create ASP.Net pages

This is the part where we will create the ASPX pages.  To do this we will a Module to our solution.  Modules allow you to deploy files to various locations in a SharePoint site in which the your Feature is activated.  We are going to add two files to the Module.  The first will allow someone to enter some text and click a button to submit it.  The next will show that text that the user typed.

Create a new "Module" (right click the project and choose Add -> New Item).

Call it "DataEntryApp.aspx"



This will create a new file in a Module file in your project under the Modules folder.

Add another called "DataDisplayApp.aspx".

Your Solution Explorer should now look like this



The next thing we need to do is add a couple of C# files that will have the code that sits behind our ASPX pages.  These will house the logic behind the submit button and the display form.

Add a class file called "DataEntryApp.cs" and "DataDisplayApp.cs" to the root of your project. 



We are now ready to start fleshing out the content of the pages and the code.

Open up "DataEntryApp.aspx" and add the following HTML (at the bottom of this post you will find a zip file with the full contents of the project, so you dont have to type all this in if you dont want to)



Open up "DataEntry.cs" and add code behind for it like this



Open up "DataDisplayApp.aspx" and add the following HTML.



Open up "DataEntry.cs" and add code behind for it like this



3. Build & Deploy

We are now ready to build and deploy the solution to SharePoint.  Couple of things before we do that however.

Open up the "WSP View" panel.  If you dont see this you can find it under View -> Other Windows -> WSP View.


The WSP View shows you how your solution is going to be packaged into the WSP.  It allows you to drag and drop your Features around to get the model you want.  It also allows you to open the XML files and tweak with them if you want to.  This is a HUGE improvement over VSeWSS 1.0 where this was not possible.


Open "feature.xml" and modify the name of our solution to something more meaningful like "My Data Entry Application".  This is the name of the Feature in SharePoint.  (By default in the CTP of VSeWSS this has a GUID and does not read very well.  That will be fixed for the final release too).



Now we are ready to build the solution

Build -> Build DataEntryApp



This will compile your projects code.  However we also need to package the solution into a WSP and deploy it to SharePoint.  Fortunately, VSeWSS does this for us so we dont need to do any of this by hand like we had to in the past with scripts and nasty batch files.

Deploy -> DataEntryApp



If your deployment was successful you should see "Deploy succeeded" in the lower left of the Visual Studio window.



4. Try it out!

Navigate to http://<your server name>/DataEntryApp.aspx  You should see an error like the one below.



The reason this error occurs is because our page was not able to load the DataEntryApp.DataEntry type from our DLL.  Why was it not able to do this you might ask?  Well, actually it is due to our DLL with our compiled code not being packaged and deployed into the correct place :( 


There is a bug in the CTP of VSeWSS 1.1 which will not package up your DLL into the WSP unless there is a WebPart or an Event Receiver in your project.  This will be fixed in the final version of VSeWSS 1.1.

As a workaround for now we have to have a event receiver added to our project.

Add -> New Item -> Event Receiver



Change the name if you like and when you click "Add", choose "Document Library".



By default VSeWSS will deploy the DLL to the GAC.  Typically this is not the best solution and you might like to deploy your DLL to the /Bin directory instead.  GAC deployed code runs with Full Trust.  Unless you need that full trust it is better to deploy the DLL to the /bin directory ... just like regular ASP.Net applications.

To do this, go into the WSP View panel and open up "manifest.xml".

Make sure your <Assemblies> section looks like the one below.  You may need to change your PublicKeyToken if you used a different key file to sign the assembly with.



Now we can deploy again.

Build -> Deploy DataEntryApp

This will retract the solution, remove the solution, add the solution & deploy the solution again for you automatically.  It will also recycle the IIS application pool for you.  No need to do an IISRESET in most cases!!



Make sure it was a success



Now refresh the page in the browser again and your page should spring into life



Enter some text and click the "Button".  If everything has gone correctly you should see the text you typed in echoed back to you on the DataDisplayApp.aspx page.



I hope this illustrates how simple it is to start creating a ASPX page based application in SharePoint.  Of course there are other ways to build applications in SharePoint (WebParts etc...) so you should pick which method suits your needs.  For more info on that see: Application Development on MOSS 2007  & WSS V3

I am going to repost this when the final version of VSeWSS 1.1 is released as some of the steps will have changed & bugs removed πŸ™‚

If you have suggestions for future topics you would like me to post about on Development with SharePoint please comment.



Comments (34)

  1. Chris –

     I’ve noted in all the articles about WSS/MOSS development, you are basically installing WSS/MOSS on a server and installing Visual Studio on that machine to do development.

     We’ve got lots of issues with MOSS development – we’re a major financial institute – since we 1) typically don’t allow developers access to servers and 2) don’t allow Visual Studio on anything but a desktop.

     So is there a configuration where our developers could write code locally, then move/publish the code to a development server for initial testing?  Or are we really kidding our selves and should allow our developers to use servers.  

     And please don’t mention VM’s running Server + MOSS – very big no-no in our organization – VM’s on desktops/laptops are patching nightmares.

    Thanks for your articles,

    Chris Lewis

  2. iwhp says:

    Thankx Chris… Will there be a VS.2008 version of VSeWSS? Cheers Harry

  3. chjohn says:


    The final release of Version 1.1 will still only target VS2005.  We are actively looking at VS2008 support for the next release.



  4. chjohn says:

    Hi Chris,

    You are not alone.  We hear this feedback loud and clear!  I am a huge advocate for getting this sorted out & making developers lives easier in this regard.

    Today you basically have 2.5 options:

    1. Each developer has a dedicated Win2K3 install with SharePoint + VS etc…  This is the best performant and fully featured solution today.  Build/Debug are all supported etc…

    2. VPC. Not an option in your case by the sounds of it, but a solution if hardware is not available.

    2.5  You can compile sharepoint code on a workstation if you copy across the SharePoint DLLs from the server that you need.  However,  you cant debug etc… so i would argue that it is a very poor solution.  I strongly believe that a quick F5 experience is key to developer productivity.  Hence the 2.5 πŸ™‚

    We are looking at ways to make this story better for our developers.  We understand the gravity of this problem fully & I personally feel your pain from spending the last 5 years as a SharePoint developer.



  5. Nice stuff !! My customers increasingly want to mix Sharepoint 2007 and custom ASP.NET apps/pages.

  6. Body: Ari has blogged about the Fly Buys web site we designed and developed for Loyalty New Zealand using

  7. srinivas says:

    Nice article !!.Please clarify me,whether feature.xml and elementFeature are created automatically?

    If possible,proive me some links which would give me more information on maifest.xml,feature.xml and elements.xml as these are key xml files for deployment.

  8. Vijay says:

    Hi Chris,

    This topic was really useful and helpful for creating and deploying the .aspx pages in WSS 3.0. Can you kindly guide me how to create and deloy the .aspx pages in a Sharepoint Portal Server Site.

    Thanks in advance.


  9. Vijay Jose says:

    Hi Chris,

    How can we deploy the same .aspx pages in different WSS sites? Can you please guide me on this.


  10. chjohn says:

    Hi srinivas,

    Yes those files are automatically created for you.  

    Full MSDN documentation is available here for all those files:

  11. chjohn says:

    Hi Vijay Jose,

    For files that you want to have on many sites you have a couple of options.

    a) package the file in a feature (as above) then activate the Feature on each site you want the files on.

    or if you want to Share the files between all sites…

    b) You can deploy the file to the _layouts directory.  To do this add a Template item to your project.  Then create sub directories under that in your project "LAYOUTS/MyApplication" put the files you want to deploy in that folder and your files will be deployed to a shared location e.g:  http://myserver/sitename/_layouts/myapplication/myfiles.aspx&quot;

    See here for a write up on how to do this:



  12. If you will be updating this for the final release.

    We have had some build issues with your sample and included ZIP file.



  13. chjohn says:

    Hi Stephen,

    Yes i will update this post for the RTM 1.1 bits.  However, i have not had time to do this yet.  I will try and get this done in the next week or two.



  14. weslleywang says:

    Hi Chris:

     Nice Article.

     I tried it yesterday but I failed. I did not see anything in WSP View except manifest.xml. What I could be wrong about?

     Thank you,


  15. Wouter says:

    Is there an updated version for vsewss 1.1 rtm?

    This (Visual Studio 2005 Extensions User Guide, Version 1.1) didn’t help me.

    As for this tutorial:

    When adding a module i get an folder with some files, not an .aspx page.

    When i open your sample project vs2005 says he doesnt know .csproj

    When I import the .aspx and .cs files from your sample project I cannot continue to step 3 because i cant find "WSP View" anywhere in vs2005.

  16. NG says:

    Thanks very much for the article,

    My problem is in "2. Create ASP.Net pages" step.

    When I create a module, calling it whatever.aspx or .whtever it is always a folder with an xml and txt files … no way to have them aspx pages

    am getting crazy !!

    how trivial problem ….

    What is the problem here plllllllls?


  17. K.Mustafa says:

    First of all , its an excellent example & a great job

    many thanks …

    but please could you help me getting it done using VB not c# , cause im facing a problem making the event

    I’ll be thankfull…

    My E-Mail :

  18. chjohn says:

    Wouter and NG,

    You can rename the txt file to a .aspx file.  You will also need to go into the xml file and change the name to .aspx aswell.


  19. CSR says:

    Great Article, is there a way to deploy the DLL to the GAC ?

    I am using vsewss 1.1 final release.

    I could not get it to work when deploying to GAC and I get the error referenced above about "an error occurred in the processing of "."

    I would like to use the GAC because of security reasons.

    Any help would be appreciated


  20. Jeff Miller says:

    Nice posting but I have some concerns that this VSeWSS tool is a little half-baked after playing with it for a week or so.  The question is this – how do I include other folders containing files such as images or javascript?  I’ve tried a myriad of different ways to do it and none work.  Keeping it in the same folder as the ASPX page, the image file gets deployed to the SharePoint site – I can tell this by looking at the site with SharePoint Designer but the image does not show up on the ASPX page nor can I access it through the browser.  Creating subfolders under the feature folder doesn’t seem to work either although I’m not sure how to tell exactly.  Is there additional documentation beyond what comes with the 1.1 release of this tool?  Thanks!

  21. m.c. says:

    I think I have followed all the steps, still could not get it to work, anybody with success?

    Error Msg:

    The file or folder name contains characters that are not permitted.  Please use a different name.

  22. Yashoda says:


    I am getting the following error:

    The referenced file ‘/_catalogs/masterpage/BlueBand.master’ is not allowed on this page.   at System.Web.UI.TemplateParser.ProcessError(String message)

      at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)

      at System.Web.UI.PageParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData)

      at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)

    What could be the possible reason?

  23. chjohn says:

    Hi Jeff Millar,

    If depends where you want to deploy your files to.

    a) if you want them in the _layouts folder then you should add a Template project item to the project.  This will create a Templates directory in your project.  Files put in there will be deployed to the Templates directory on the SharePoint filesystem.  You can create sub folders in there such as LAYOUTS to deploy into the _layouts directory.

    b) if you want the files deployed INTO your sites virtual filesystem then you should add a Module project item.  You can add your files into there and they will be deployed into you site when the feature is created.



  24. Chriss Delrose says:

    If I want the files to be deployed In to sites virtual file system, Where are these files will be stored? If on the file system what’s the path going to be? or in the content DB as a customized file?

    Appreciate your valuable input and time πŸ™‚

  25. chjohn says:

    Hi Chriss Delrose,

    If you deploy files into the sites virtual file system then those files live in the SharePoint Content DB along with the other pages that make up that site.



  26. frustred... says:

    Does anybody knows, it’s possible to do this in final 1.1 version… ? ( i’m trying for 2 days :))


  27. chjohn says:

    Hi frustred,

    What is the issue you are having?


  28. Aaron says:

    What the heck is up with this!?

    I am trying to follow along with this and NOTHING is as its explained?  I mean, nothing …

    I was able re-work the Modules folder as desribed earlier in the comments but lots of other stuff is different too.

    Can anyone direct me to a better post on this subject?

  29. chjohn says:

    Hi Aaron,

    I am happy to help you out if you like.

    First up, what version of VS and VSeWSS are you using?

    I have been meaning to re-write this post on the newly launched VSeWSS 1.2 bits with VS2008.



  30. Krishna Prasad says:

    Hi chris,

    Thanks for giving us such a nice blog. I have a quick question to you .Can’t we build the site pages like this using the solution packages in sharepoint ,as we  build the application pages.

    If so, could you please suggest me some links to the same ?


    Krishna Prasad H

  31. Anurag says:


    I am trying to create new .aspx page under the SharePoint site. I am followed the given steps.

    1.Create Web Application in VS2008 and new page(called Demo.aspx) under it.

    2.In code behind implement the OnPreInit() method.

    3. In aspx page place the <asp:content contentplaceholderid =PlaceHolderMain runat=server/> and deployed in LAYOUTS/Test/Demo.aspx.

    4.Signed the assembly and deployed in GAC.

    I think I am following the step to use custom aspx page under sharepoint environment.

    Still It throw error..(Content Controls are allowed only in content page that reference the master page)….

    You help will be highly appreciated….



  32. jagadeeshcv says:

    Hi chris,

            Excellent Post But i have one problem here,

    i have created one apllication page for any list that is uniquefileds.aspx ,that page i have created as a feature

    by using normal classlibrary and deployed it by using install.bat file.the uniquefileds.aspx were created as a

    new element in list general settings.what it will do is it will capture all fields available in the list .there we will select one or more fields for not allowing duplicate values.

    From here my problem starts

    I want to Get those selected values from application page and able to raise itemadding event   for that list   by comparing the selected values in the application, It may happen for any list

    i will really appreciate if you help this problem..

    My mail



  33. I want to know what this sharepoint is all about………Searched it on net but there was no proper info over it…………I would really be thankful if you could help me……….Please provide information over it. Provide links to related topics if possible.

  34. abhishan says:

    Nice post, and very informative. We have tried using similar approaches.

    When using a custom database and the aspx page execute stored procs on the DB to fetch/write data from/to the DB, it fails with access denied error.

    This is because the DB connections are dne with the credentails and authentication tokens of the currently logged in user in MOSS. So every time we have to manually add an AD group as db_executor for the custom DB.

    Any ideas on how to avoid this. Any help would be appreciated.

Skip to main content