When developing SharePoint applications, you sometimes need to create a file system custom page under _ layout to meet special requirements, for example, you can use only SharePoint object models instead of using Sharepoint to store pages in the DB. in this case, we can create a custom application.ProgramDeploy the page to the _ layout directory of the website.
When creating an application, you have two options:
- Website
- Webapplication
For the differences between the two different project types, we will not mention them here. You can find them through Google. the following two methods are respectively used to create a project and configure to enable debugging.
Create a website
Open Vs and create a website. You can use HTTP or files in "location", as long as they are created in the _ layout directory.
REFERENCE The SharePoint DLL and write reponse. Write (spcontext. Current. Site. url) in page_load to test whether the context object can be called.
Create webapplication
Create a webapplication project in Vs, and then perform the test above, specify the "generate" output location of the webapplication project to the bin directory (not _ layout) of the entire SharePoint application, and modify the web. <trust level = "full"/> in config.
Neither of the above two methods can be directly debugged by pressing F5 in vs. Both of them must be appended to the w3wp process using, the breakpoint is triggered by directly browsing the corresponding webpage in IIS.
Summary
in the website method, the dynamically generated DLL does not pass the web. config modifies the trust level, and does not place the DLL generated by it into the bin, nor deploy it in the GAC, but it can run correctly, it is suspected that Asp.net has some special settings for storing the dynamically generated DLL location, while webapplication does need to modify the location of the project generation and web. config to make it run correctly. however, either way, the DLL generated by the project must be put in the bin and modified when it is finally released to the build or integration environment. in config, you can either use a strong-name signature and deploy it to GAC (website dll may be right-clicked on the vs project, right-click the menu and select "Publish Website" to generate ).