Create a website or webapplication to directly use the SharePoint Context

Source: Internet
Author: User

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:

    1. Website
    2. 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 ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.