ASP.NET Web Projects
This kind of web site is project-based like other Oxygene projects, without some of the additional directory structures (like App_Data) that you find in a directory-based web site. However, one trade-off is that you can only use one language per site; any C# you want to bring in must be in a separate class library.
The non-ASP.NET files (.asmx, .aspx, .ashx) of Web Projects are compiled by the IDE as a class library to the Bin/ directory that will be referenced by the the ASP.NET code. For directory-based web sites, see Web Sites.
New web projects are started via the File | New | Project dialog, just like other Oxygene projects. Simply navigate to the Web folder under Oxygene and select the kind of site you want to use.
Once a new website has been created, new elements can be added to the project via the New Items dialog, as in a non-web project:
Again, unlike in a directory-based web site, all items in a web project have to be in the same language.
Unlike ASP.NET Web Sites, all ASP.NET Web Application code source files, including codebehind ones, are compiled into a single assembly. This approach has two major advantages:
- All syntax errors will be found during build time (note that with the dynamic compilation model of ASP.NET Web Sites the site itself still can be deployed, even if some of the codebehind files contain errors).
- Simplified and more secure deployment (you can just copy the compiled assembly and visual elements to the IIS folder, while Web Site requires you to copy everything (including codebehind source files and the content of the App_Code folder) to the IIS to work).
An ASP.NET Web Application can be deployed in several ways:
- You can just copy all content files (*.aspx, *.html etc), the web.config and the contents of the bin folder into the IIS website folder. Please note that this approach requires a registered Oxygene CodeDom on the server (it can be registered via installing the command-line version of Oxygene), which is not always possible.
- You can create a Setup or WebSetup project, which will simplify copying the needed files to the IIS website folder; this approach also requires a registered Oxygene CodeDom.
- You can precompile the WebApplication before it is deployed to the production web server. The precompilation process results in a set of files that can be deployed on a web server and Oxygene CodeDom does not need to run the WebApplication.
You can find more about ASP.NET precompilation in this MSDN article. In other words, you need to use the aspnet_compiler.exe command-line tool to precompile an ASP.NET Web Application. This command, for example,
aspnet_compiler -v TestWebsite -p d:\WebAppDeploy d:\PrecompiledWebApp
takes the assemblies and content files of the WebApplication from the d:\WebAppDeploy folder and precompiles them, placing the result into the d:\PrecompiledWebApp folder. This website should be deployed as TestWebsite (note the -v option), otherwise you'll get errors while trying to access it.