Problem with "dynamic" usercontrols in web application project


A web-application I'm currently working on allows users to create new usercontrols on the site (as in writing the code for the .ascx and the codebehind file, and yes I'm aware of the security issues).

The usercontrol will always inherit from a base class defined in the web-application.

These usercreated usercontrols will later on be dynamically added to the site like this placeholder.Controls.Add(Page.LoadControl(pathToUsercontrol))

So far so good, but try to load the control I get this error: "CS0433: The type UsercontrolBaseClass exists in.." followed by path to two autogenerated DLL's.

I'm guessing this is because the UsercontrolBaseClass is compiled first when I compile the web application, and then once more when the usercontrol (which is not compiled but inherits from UsercontrolBaseClass) attempts to load.

I tried setting <compilation batch="false">, but that didn't help.

Any ideas?

Best regards, Tchami




9/20/2007 1:59:45 PM 1239 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 19


Turns out I was on the right track. The App_Code folder (in which the baseclass was placed) is compiled both at compilation and later when viewing the site.

Solution: Create another folder and move your classes from the App_Code folder to the new one.

Some might be wondering why I had the App_Code folder there in the first place (as it's not part of the WAP). The reason for that is that the project is a converted web-site project.

9/21/2007 12:34:47 PM

Similar Artilces:

Problems deploying Dynamic Data web application using "Web Deployment" project
Hi,  When I attempt to deploy a dynamic data web application using a "web deployment" project, only about half of the folders inside the "DynamicData" folder get copied properly. Here are the steps to reproduce. Prerequisites: Visual Studio 2008 .NET 3.5 SP1 Web Deployment projects add-on installed (I forget the exact name of this tool) In VS2008, go to File, New Project, Dynamic Data Web Application Right click on WebApplication1 and select "Add Web Deployment Project..." Accept the defaults and click OK. Right clik the web dep...

Trying to bring in 1.1 project as VS2005 "Web Application Project"
I have a 1.1 project from a few years ago and am trying to turn it into a 2.0 project, but when i open VS2005 (with SP1 installed) and then open the "sln" or "vbproj" file in the project, i get prompted with "The following web web projects must be convered to the new Web Site format" Where is the option to use Web Application Project instead of Web Site format?   Wasn't that one of the "gee whiz" things MS was bragging about in Service Pack 1?"If you make it idiot proof, they'll build a better idiot" I think you can try ...

Web application project or Web site project which is "better"?
Hi,We are a bit confused as to which web project type is best to use.Currently we have a number of large projects in the old style with .vbproj files. These have been upgraded to VS2008 web application projects. Compilation seems slower of upgraded projects than created from scratch web site projects. I do get the impression MS is pushing the new style format for future releases.What are the advantages/disadvantages of the new web site project?Where do references get stored in the new style project?Where do the control declarations get hidden in partial classes?Thanks, Alex ...

A "Web Application Project" for web-services ?
I was wondering if there is something analogous to the "Web Application Project" VS add-in for Web-services. By analogous I mean: 1. All the source files in a Web-services project is compiled into a single assembly, perhaps with the exceptions of the .asmx file 2. Property pages for the project in VS display all the tabs that are available in other kinds of projects - i.e., for example, ability to specify pre and post build events, the XML documentation file etc. I really appreciate any help. Cheers, Adrigo Yes, the current release supports creating an "ASP.Net Web Service Applica...

No "Add web deployment project" for web application
I've installed the web deployment project, opened several examples with web application project with web deployment project added to it and would be oki, exept for one thing. I don't  have a  "Add web deployment  project" in build menu (the right click menu and the top menu) for web application, but for web site it apears. Could anyone explain why? Examples that i saw had web deployment projects added to wec applications.Thanks for any help.   I think maybe you install not correct with your Visual Studio  So try to install Visual Studio 20...

switch project from "file" to "web"?
I've taken over a project from another for a webservice. He originally set it up as "file" based, so it's showing up as "c:\path\to\site" in the solution manager. This is causing issues and it should be setup as a website with http://virtual/to/site. Is there a way to switch a file based one to a web based one and have it use IIS ?   Nevermind... just readded it manually to the solution, seemed to work Hi: I think you are talking about an ASP.NET 2.0 application? You can simply make a File System application work smoothly with IIS, by creating a new website poiting to the folder ...

Problem when deploying Web Application project over VS2005 Web Site project
Hi,  we ran into this issue yesterday evening when we were trying to deploy new code on production box. It was running previous version of our app that was VS 2005 Web Site project, but the new version was migrated into Web App project. New build was tested on sandbox and even on the same production machine (but under different, non public web site configured there) and was working fine. However, when we deployed on production web site, we got this error:Compiler Error Message: CS0246: The type or namespace name 'ProfileCommon' could not be found (are you missing a using directi...

problem with a web project I added as an "existing web site"
I've got a nettiers (DAL) solution that has 5 sub projects in it.  Each with their own dependencies. I copied a web site project into the root of the tree, then said "Add Existing Web Project".  Somehow, when I rebuild, that project gets skipped.  My question is how can I make my web project a first class project in the solution so that when I say "refernece other project" the dependencies automatically work (that is, move dll's into the bin of this web project) and of course I want that project to rebuild right along with the rest. Thanks!  Peter Kellnerhttp://73rds...

"Web Application" Project Information
Microsoft has recommended that we switch our project to use the Web Application Project, currently being worked on by Scott Guthrie, rather than the new model in Visual Studio 2005.  The reason for this basically is that we have a very large project and it takes about 15 minutes to do a compile.   I'm wondering what we lose if we move to a WAP project.  Can we still precompile our project so that performance is better for the users? In VS.NET 2003 we had an issue where Visual Studio would lock up the data access .dll after doing a get latest version from source control...

"Open project from web" problem
Hi all, Have a strange problem. When I try to use "Open projekt from web" in VS its all blank. I cant see anything. In the IIS I see my projects fine, all the files and everything. Have try to reboot the IIS and the server but without result. Have also checked the webinfo and the sln file for the project and they look ok. Anyone have any ideas about this? Thanks in advance Markus the FrontPage Server Extensions are enabled in the IIS ? to use the Open Project from Web you must enable the frontpage server extensions....but really...this is not recommended by securi...

"The project you are trying to open is a Web project" Error
When I try to open the project from web at http://localhost/ngallery/nGallery.csproj in visual studio, I get this error: The project you are trying to open is a Web project...

"Dynamic" Web Services, "Dynamic" Parameters
This is a follow-up discussion from I noticed we stopped talking about Peter's problem some time ago. The discussion had become one of passing "XML strings" to a web service in order to permit optional parameters, a dynamic web service, and things like that. My contention is that this is a solution without a requirement. It is something that we can do, which does not imply that anyone needs us to do it. First of all, if you need to send XML, then send XML. Do not send a string that happens to have XML embedded in it. ASM...

VS 2005 "Web Deployment Projects" project lacks macros?
I'm trying to create the equivalent of a post build event for a website.  I have the "Web Deployment Projects" add-in installed and am attempting to follow the instructions in the "Using Web Deployment Projects with Visual Studio 2005" document.  In the "Customizing Web Deployment Projects" section, it gives an example of an "AfterBuild" target where a directory is created using the $(TargetDir) macro.  When I attempt to use $(TargetDir), it doesn't seem to exist.  The only macros I can find that work within the .wdproj file are solution level (SolutionPath, Solut...

Unable to copy file "obj\Debug\Project.dll" to "bin\Project.dll"
Hi. This is really flustrating. When i compile my WebApplication, it works normally. But when i do refresh in browser, than IIS somehow "locks" that dll file and another compilation ends with this error:Unable to copy file "obj\Debug\Project.dll" to "bin\Project.dll". The process cannot access the file 'bin\Project.dll' because it is being used by another process.After restarting application pool in IIS, it's released and i can compile in standard way. I tried use handler.exe from sysinternals and it shows, that w3wp.exe process is using that dll. It...

Web resources about - Problem with "dynamic" usercontrols in web application project -

Resources last updated: 12/11/2015 12:26:27 AM