By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,485 Members | 1,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,485 IT Pros & Developers. It's quick & easy.

Compiling multiple pages to a single code-behind page in VS2005

P: n/a
Hi,

I'm putting together a project that uses ASP.NET in VS2005. It uses a
single master page that is responsible for most of the heavy lifting. About
90% of the 200 pages have the same code-behind, so I implemented all of
these pages so they would reference the same code-behind cs file, as
follows:
<%@ Page Language="C#" MasterPageFile="~/MyMaster.master"
AutoEventWireup="true" CodeFile="~/Template.aspx.cs" Inherits="Template"
Title="Page Title" %>

The problem is, though, that the project is taking forever to compile, and
there are only about four lines of code in the Template.aspx.cs file, which
I was hoping would only compile once for that single page. When I publish
the project, it creates a DLL file for each page, regardless of whether I
check the Use fixed naming and single page assemblies checkbox.

So, is there any way that I can force the compiler to compile the
Template.aspx.cs class only once and have it apply to all pages that Inherit
that page?

Thanks, Jim
Nov 20 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The compile times are due to each page having to reocmpile the common bits
and causing a compilation war. There is no reason to do this.

Options
1. Move common code into a class and call from each page - this does not
really solve the problem, but does provide for reuse of functionality
outside the website.
2. make a class that inherits from page and set pages to inherit from it
instead of page - best option if the code is really the same. Compiles once

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside the box!
*************************************************
"LiveCycle" <li*******@sandbox.etech.adobe.comwrote in message
news:Oy**************@TK2MSFTNGP02.phx.gbl...
Hi,

I'm putting together a project that uses ASP.NET in VS2005. It uses a
single master page that is responsible for most of the heavy lifting.
About 90% of the 200 pages have the same code-behind, so I implemented all
of these pages so they would reference the same code-behind cs file, as
follows:
<%@ Page Language="C#" MasterPageFile="~/MyMaster.master"
AutoEventWireup="true" CodeFile="~/Template.aspx.cs" Inherits="Template"
Title="Page Title" %>

The problem is, though, that the project is taking forever to compile, and
there are only about four lines of code in the Template.aspx.cs file,
which I was hoping would only compile once for that single page. When I
publish the project, it creates a DLL file for each page, regardless of
whether I check the Use fixed naming and single page assemblies checkbox.

So, is there any way that I can force the compiler to compile the
Template.aspx.cs class only once and have it apply to all pages that
Inherit that page?

Thanks, Jim

Nov 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.