C# Development: Implementing ASP.Net Web Sites and Web Applications in CrownPeak
CrownPeak templates can be used to implement ASP.Net Web Sites and Web Applications. This article gives an overview of options and the development process.
Scenario (Use Case)
It is common to use CrownPeak to publish content to .Net sites. Read below for information on how the CMS can work with different code models before you create your application to learn how to integrate it with the CMS.
- A site that will be published to an IIS web host and use some flavor of ASP.Net.
Configure your server-side .net project
Configure and create your source .net project outside of the CMS. You will then configure your CMS instance to publish a site that mirrors the structure of it. It is a best practice to create a complete local dev environment that will mirror the configuration on the webhost. They you can reference this model to troubleshoot your published site.
CMS Managed Pages
- Because the CMS will serve as your content database, you do not need to build SQL queries or manage data connections to access this content. Instead, you will publish webforms (.aspx files), user controls (.ascx files) or data files (XML or JSON) to deliver this content to the web host. For example, you can configure CMS templates and publishing to manage filtered content such as news releases that available by month and year instead of using server side code.
- Create sample pages as needed representing different page types for your site (e.g. Press Release page, Home Page, etc.) At this point, these generally just need to be static mockups based on your designed HTML, but should reference your masterpages and any custom code and work within your development environment.
ASP.Net Code Models
- ASP.Net supports three code models, In-Line, CodeFile and CodeBehind. (These "code models" are not to be confused with MVC, or Model-View-Controller Models)
- When configuring your web application and CMS templates, it's important to understand options for compiling ASP.Net code.
- Pay close attention to the Inherits, CodeFile and/or CodeBehind attributes of your content pages. The CMS publishes text and binary files following the template and publishing configuration you develop.
- Your published site will need to run independently on the web host after publishing.
- Templates can be configured to deploy either pages that are compiled on the fly by IIS (In-Line code (in