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'm fairly new to SharePoint, and I was given the task of creating an application that basically consists of a couple of static pages that consume Java-based web services.

Currently, I'm creating these application pages with Visual Studio 2010, which automatically maps them to the Layouts folder, therefore making my pages accessible as http://localhost/_layouts/MyApplication/MyCustomApplicationPage.aspx.

What I'd like to do, is to customize these URLs, and structure my application pages in several directories, in order to access them as, for example, http://localhost/MyCustomDirectory/MyCustomApplicationPage.aspx, instead of http://localhost/_layouts/MyCustomDirectory/MyCustomApplicationPage.aspx.

In other words, I'd like to remove the _layouts part from the URL, and replace it with my own subdirectories. Is this possible without creating virtual directories in IIS? I do not have physical access to the server; all I can provide is a WSP.

share|improve this question
up vote 6 down vote accepted

No, that's not possible in SharePoint, application pages should be in the _layouts folder (or _admin for application pages for central admin).

You can put pages as http://localhost/MyCustomDirectory/MyCustomApplicationPage.aspx, but then they should be site pages, which you provision using a "Module" element from Visual Studion. But be aware that then users will be able to modify them using SharePoint designer.

Technically it's possible to put application pages in another path by introducing new IIS virtual directories, but you shouldn't do that.

share|improve this answer
Thanks for the answer (I'd upvote it, but it requires 15 reputation). I have just a few more questions. The IIS virtual directory is out of question since I do not have physical access to the server, so everything has to be set up with a WSP. Using a Module, I could create my custom directory, and add my application page to it. Would I be able to access SPContext, and set DynamicMasterPage using this strategy? Also, regarding user modification, is there any way to prevent it from happening? Thanks. – João P. Silva Apr 1 '12 at 11:27
If you put all the logic in a control and/or inherit from a class other than WebPartPage, then there is very little that SharePoint Designer can do. And, if users need to customize the page, well that is what WebPart pages are fore. – Paul Schaeflein Apr 1 '12 at 14:14
You have full access to SPContext, but there is no need for using DynamicMasterPage, you just set MasterPageFile to the dynamic token. You can still inherit the page from your own class, but note that if you don't register that class as a SafeControl, then the page stop working if a user customizes it using SharePoint Designer – Per Jakobsen Apr 1 '12 at 16:25

It is possible.

Install CKSDEV on your development machine, and then add a Basic Site Page to your project. While that SPI won't give you a code behind file, you can certainly tweak it to use one, just like any other ASP.NET page.

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.