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

I'm deploying an application page on sharepoint 2010 but why I can't deploy it only on a web application. I can only deploy it globaly...

I tried to change the option in visual studio 2010 but I have a security error when I access the page.

Thank you

share|improve this question
    
do you mean deploying to specific web application, not globally? –  Falak Mahmood Jul 3 '12 at 18:08

3 Answers 3

From Microsoft: Application pages are used to support application implementations in SharePoint Foundation. Application pages are stored on the file system of the front-end Web server in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS directory and exist for every site in a Web application. This folder is mapped to an Internet Information Services (IIS) virtual directory called _layouts. Every site and subsite will have access to the application pages by using the _layouts virtual directory. For example, "http://myserver/_layouts/settings.aspx" and "http://myserver/subsite/_layouts/settings.aspx" access the same application page on the front-end Web server unlike site pages, which are an instance for the specified site.

Application pages are not subject to the same restrictions as site pages. They allow in-line code without restriction. They cannot, however, use dynamic Web Parts or Web Part zones or be modified using SharePoint Designer. Modifying the default application pages is not supported in SharePoint Foundation. Custom application pages can be added to a subdirectory inside the _layouts folder.

share|improve this answer
    
Thanks for your fast response. What are my options if I want to deploy a custom page on some of my web applications. This custom page extract and send some user information to a third application. –  Kernity Jul 3 '12 at 19:33
    
Can you explain what you are trying to do a little more? Why wouldn't an app page work for you? –  sween_sp Jul 3 '12 at 19:56

An application page is deployed to a subdirectory of {SharePointRoot}\TEMPLATE\LAYOUTS (that's the definition of an application page (except that it can also go to {SharePointRoot}\TEMPLATE\ADMIN)) this happens when your WSP is deployed.

This means that it can be accessed from all web application if the users know the url of the page. Usually you'll provide a link to the Page somewhere using a CustomAction, the feature containing the CustomAction can have WebApplication scope (and ActivateOnDefault="FALSE") which means that the link will only show up in the WebApplications on which you activate that feature.

If you want the code in your application page can check if the feature has been activated in the current WebApplication and return statuscode 404 (or another error message of choice) if not.

share|improve this answer
    
You say that "this means that it can be accessed from all web application if the users know the url of the page".. but dont they need to have some permission to see the page? Or do you mean it is a public page? –  variable Apr 3 at 17:24
1  
Depending on what the page does they may need some specific permissions. But they can call that page on any SharePoint site and the only way to limit it to a single web application as asked for in the question is through code in the page. –  Per Jakobsen Apr 3 at 18:04

You custom application pages are accessible across all the web applications and can be access using the \Layouts folder, so doesn't matter if your WSP is deployed globally or to a specific web application, your custom pages will be accessible from all web applications.

As for deploying Visual Studio 2010 WSP to a specific Web application - SharePoint will only deploy to a web application (or allontenturls) if it needs to to modify a web.config file, like for instance if it is inserting a safe control entry (in case, if you Visual studio solution contains Web part or user controls). Or solutions dll needs to be deployed to the BIN directory instead of the GAC etc.

Follow this MSDN blog for more details.

share|improve this answer

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.