Steve
So close, but not quite what I meant. I know how to have ASP.NET automatically compile the code-behind .cs filr for my ASPX or ASCX. My problem is that I want to create a few utility classes that are used around my site and called from within some of those code-behing .cs pages, etc. But I don't want to have to pre-compile those utility classes. Do I absolutely HAVE to precompile a .CS stand-alone class to use it from other .ASPX, .ASCX, and Code-Behind .CS files
And if I *do* have to pre-compile them, I'm just curious as to why I have to when I don't have to manually pre-compile the ASPXs and their code-behind .CS files
Thanks
Ale
----- Steven Cheng[MSFT] wrote: ----
Hi
Based my understanding, does the problem you mentioned as
"Is there ANY way to have classes defined in .cs files somewhere and have
them accessed by my ASPX, ASCX, and Code-Behind files WITHOUT having to
manually compile them first???
means that you just want to provide a certain .cs codebehind class's source
file for a aspx page or ascx control without compiling the cs file into
assembly and let them be compiled at runtime when the certain page or ascx
control is requested, yes
If so, I think you can use the "Src" attribute in the @Page or @Control
directive, for example
<%@ Page language="c#" Src="xxx.cs" ><%@ Control Language="c#" Src="xx.cs"
The "Src" will make the code-behind class files be compiled on demand
instead of precompiled. An
the "Src" attribute is listed with the relative path of the code-behind
class file (SrcSample.aspx.cs), and that the Inherits attribute value is
set to reference the certain class(classname with full namespace). In
addition, when you use the "Src" attribute to make the code-behind class
compiled at runtime on demand, you must make sure no precompiled classes in
the existing assemblies in the web application's reference path, othewise,
you'll encounter some unexpected errors. For detailed info, please refer to
the following kb articles
#INFO: ASP.NET Code-Behind Model Overvie
http://support.microsoft.com/?id=30324
#HOW TO: Work with Code-Behind Class Files in an ASP.NET Application by
Using Visual C# .NE
http://support.microsoft.com/?id=30814
Regards
Steven Chen
Microsoft Online Suppor
Get Secure!
www.microsoft.com/securit
(This posting is provided "AS IS", with no warranties, and confers no
rights.
Get Preview at ASP.NET whidbe
http://msdn.microsoft.com/asp.net/whidbey/default.asp