views:

434

answers:

2

I get the following error message trying to run my page

Compiler Error Message: CS0433: The type 'usercontrols_BirthDetails' exists in both 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5c377e82\1f883022\App_Web_ub0hcxgl.dll' and 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5c377e82\1f883022\App_Web_3ndqr5wn.dll'

The code works okay on my machine, and fails on the server as above.

Sometimes this happens on my machine, but I can fix it by closing visual studio and re-starting it. So I guess it's some conflict that happens due to some compilation mistake that ASP.Net is making.

My question is, how can I fix this on my server without rebooting it.

+1  A: 

I've had this happen on my dev machine a number of times, but I've never known it to happen on a server. And, I'm a coder, not a sys admin, so take what I say with a grain of salt, but . . .

Stop the IIS process, and delete everything under the Temporary ASP.NET files\root\ directory. That's just the place where your .aspx pages get compiled down - this isn't as scary as it sounds. Restart IIS and all should be good. And, if it's not, remember, it's not my fault - you're the one who took advice from a stranger on StackOverflow :-).

Travis
+1 for really practical ideas. I thought of doing the same thing Travis, but it didn't help. In fact it didn't help even when I rebooted the machine. The problem was somewhere else. Read below.
Cyril Gupta
A: 

Well, I did solve the problem, but the root cause was something else... Apparently it had something to do with declaring a variable of my usercontrol's type. For some reason this wasn't agreeing with ASP.Net on the server (though it was well-digested on my own machine)... I don't have any idea why exactly this was happening but this clue is a signal to Jon Skeet to step in and describe the thing in technical mumbo-jumbo.

The solution in my case was to remove the usercontrol variable declaration. I got by with a workaround.

Cyril Gupta
Wow. So long as it works . . . :-)
Travis