I am writing an ASP.NET 2.0 application that uses more than one master page.
Currently, there are two pages, Freedom1.master and Freedom2.master. I have
no problems with Freedom1.master. However, I am having problems with
Freedom2.master.
The first problem is I sometimes get the following error when I build the
site.
The type 'Freedom2' exists in both
'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\freedomlincwebsite\ae6160cc\fecd2e
a4\App_Web_ammoxc8r.dll' and
'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\freedomlincwebsite\ae6160cc\fecd2e
a4\App_Web_fxnhzrev.dll'
The error appears for each page built using Freedom2.master.
The second problem occurs at runtime for statments like the following.
protected void Page_Load(object sender, EventArgs e)
{
Freedom2 master = (Freedom2)Master;
master.Page.Header.Title = "Freedom LINC Registration";Your code looks a bit confusing, you seem to be declaring an object called
master of type freedom2 and initialising it with the value contained in it's
self cast as a type freedom2. What are trying to do with that code?
"EagleRed@.HighFlyingBirds.com" wrote:
> I am writing an ASP.NET 2.0 application that uses more than one master pag
e.
> Currently, there are two pages, Freedom1.master and Freedom2.master. I ha
ve
> no problems with Freedom1.master. However, I am having problems with
> Freedom2.master.
> The first problem is I sometimes get the following error when I build the
> site.
> The type 'Freedom2' exists in both
> 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
> Files\freedomlincwebsite\ae6160cc\fecd2e
a4\App_Web_ammoxc8r.dll' and
> 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
> Files\freedomlincwebsite\ae6160cc\fecd2e
a4\App_Web_fxnhzrev.dll'
> The error appears for each page built using Freedom2.master.
> The second problem occurs at runtime for statments like the following.
> protected void Page_Load(object sender, EventArgs e)
> {
> Freedom2 master = (Freedom2)Master;
> master.Page.Header.Title = "Freedom LINC Registration";
> .
> .
> .
> The error message states that there is a failure to cast an infinite integ
er
> to the type, Freedom2.
> What is going on? How do I address these issues? These problems are
> intermittent but significant.
> Any input is appreciated.
> Thank you,
> EagleRed
>
>
In article <31042077-F0EC-49B9-90D7-C782AEAE5187@.microsoft.com>,
"EagleRed@.HighFlyingBirds.com"
<EagleRedHighFlyingBirdscom@.discussions.microsoft.com> writes
>I am writing an ASP.NET 2.0 application that uses more than one master page
.
>Currently, there are two pages, Freedom1.master and Freedom2.master. I hav
e
>no problems with Freedom1.master. However, I am having problems with
>Freedom2.master.
>The first problem is I sometimes get the following error when I build the
>site.
>The type 'Freedom2' exists in both
>'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
> Files\freedomlincwebsite\ae6160cc\fecd2e
a4\App_Web_ammoxc8r.dll' and
>'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
> Files\freedomlincwebsite\ae6160cc\fecd2e
a4\App_Web_fxnhzrev.dll'
>The error appears for each page built using Freedom2.master.
Try stopping the server, then deleting the files in the temporary
ASP.NET files folder. Then restart the server and try again. I have seen
this cure this problem.
>The second problem occurs at runtime for statments like the following.
> protected void Page_Load(object sender, EventArgs e)
> {
> Freedom2 master = (Freedom2)Master;
> master.Page.Header.Title = "Freedom LINC Registration";
<snip>
Why are you doing it this way? Title is a standard property of the page,
even when master pages are used, so you can simply do...
Page.Header.Title = "Freedom LINC Registration";
More to the point, if you are setting the title to a fixed string, just
set it in the Page directive of the .aspx file instead of in code. As I
understand it, this gets compiled with the page, so will be a teensy
weensy bit faster too.
HTH
Alan Silver
(anything added below this line is nothing to do with me)
Needed or non needed code I have the same problem:
I usually cast master in order to hide or show some components / parts
of page. Anyhow why I want to cast master page is not an issue here.
The issue is why this cast may or may not fail.
My findings are that:
- I assume that in place compilation creates 2 copies of assembly,
- killing w3wp usually helps (if it doesn't delete asp.net tmp
folders/files),
- it may happens only after some compilation was made (after changes in
files, etc...).
I belive that, precompiled deployment is safer regarding this
problem...
I would like some more info about that problem.
bye,
D
0 comments:
Post a Comment