Hi A.M,
Thank you for the reply. Yes, I know that you would like to change the page
attribute to "Src=filepath" mode since you want to do simple modified after
deploy them in webserver. I've done some further research on the Page Code
declaration. Here is some thing I found which may be useful for you:
In When create a ASP.NET apge in VS.NET ,by default, it use the Page code
direction like :
<%@ Page language="c#" Codebehind="MainPage.aspx.cs"
AutoEventWireup="false" Inherits="NewWebApp.MainPage" %>, This means the
certain page will use the class specified by the "Inherits" attribute to
instance a itself. the "Codebehind" attribute is used just for VS.NET IDE
to bind the relation between the aspx file and the aspx.cs file. And all
the classes defined in the Codebehind file will be precompiled into the
application assembly dll. When run the page, it find the class from the
assemply dll(won't compile the cs file again). However, if you want
everytime the ASP.NET runtime to compile the .cs file, you need to add the
"Src" attribute in the <@ Page ...> directive. But be care that don't
remove any other attributes, such as "Codebehind" and specially the
"Inherits". You should set the <@ page > directive as below:
<%@ Page language="c#" Codebehind="MainPage.aspx.cs"
AutoEventWireup="false" Inherits="NewWebApp.MainPage"
Src="MainPage.aspx.cs" %>
Thus, when the certain page is requested, the asp.net runtime will
dynamically compile the page using the file specified by "Src" attribute.
But there are something you must also care:
1. When you add the "Src" attribute to the page, you should removed the
original precompiled dll built by VS.NET, you can find it in the
WebApplication's Virutal Directory's "bin" sub folder. Delete them,
otherwise, you will get error says that you have redefined the certain page
class in multi places such as :
CS1595: 'NewWebApp.MainPage' is defined in multiple places; using
definition from 'f:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET
Files\newwebapp\01b345b1\ae5bd2c2\assembly\dl2\132f2fd2\2c21bb78_52c5c301\Ne
wWebApp.DLL'
2. Since by default, all the pages or globa object's class are all
precompiled in the application assembly dll. If you delete the
application's dll, maybe some other class in it will be unable to find. For
example , maybe you have a globa.asax file which bind with a global.asax.cs
file, so you must also change its code directive, such as :
(open the global.asax file using notpad)
<%@ Application Codebehind="Global.asax.cs" Inherits="NewWebApp.Global"
Src="Global.asax.cs" %>
Add the Src="Global.asax.cs" into it so that make the global object also
compile dynamically .
Also, you can set part of your pages using the "Src" and part of them not,
but do care that don't include the class which has set "Src" attribute when
the VS.NET build the application assemly.
If you feel anything unclear in my description, you can visit the following
KB for more detailed info about
HOW TO: Work with Code-Behind Class Files in an ASP.NET Application by
Using Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;312311
Please try the preceding suggestion and see whether they help you.
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)