This is a migrated thread and some comments may be shown as answers.

Web.config Multiplicity

5 Answers 228 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 06 Jan 2011, 03:47 AM
I'm running Dot Net Nuke 5.6, VS 2010 and Telerik 2010.3 and have a catch 22.  It seems that I have multiple web.config files and maybe some conflicts.

I have the Telerik tag defined in my web.config located in the virtual directory of my site.

To use a Telerik control on my page in the VS 2010 designer I need to have a web.config file local to the project that defines the Telerik tag:

<configuration>
  <system.web>

    <pages>

    <controls>

      <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>


Without it I get the error:

Error Creating Control - radGridCustomerPoolThis control cannot be displayed because its TagPrefix is not registered in this Web Form.

However, with a local web.config in the project folder I get the following error on my page in a browser outside the VS environment.

DotNetNuke.Services.Exceptions.ModuleLoadException: It is an error to use a section registered as allowDefinition='MachineToApplication'  beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Why isn't VS picking up the tag definition in the virtual directory?

Any ideas?

5 Answers, 1 is accepted

Sort by
0
Bodevain Svensson
Top achievements
Rank 1
answered on 06 Jan 2011, 02:02 PM
Does this happen with other assembly reference defined in the web.config from the virtual folder, for example System.Web.Extensions? If so, probably the vitual folder configuration does not allow this type of assembly registration. Note that you can have Register directives for the Telerik ajax assembly on the pages where their controls are used and thus you will not need the web.config dll registration.
0
Ed
Top achievements
Rank 1
answered on 06 Jan 2011, 02:05 PM
It doesn't happen anywhere else.  I can put a register directive into the page and that works but I don't know why I need to do that if I have the tag defined in the root web.config.
0
Ed
Top achievements
Rank 1
answered on 06 Jan 2011, 07:04 PM

I have found a solution!  I needed to change the way my solution is organized and create a Startup Project in the DNNDev virtual folder.  That way the default web.config file IS the default project web.config file for debugging.  I hope this helps someone else.

The web.config file is associated with the project and there cannot be multiple web.config files.  It must be in the same project folder that the VS project is in for debugging.   What is needed is a VS project at the virtual folder level.  

So, the solution is to create or copy a VS project to the virtual folder and set it as the Start Up Project.  Copy your existing web.config to the configuration files as below and add a new Web Configuration item to the DNNDev project (right click your solution | add | new item | web templates | web configuration)

 So you end up with this taxonomy:

…\DNNDev\DNNDev.sln
…\DNNDev\DNNDev.csproj
…\DNNDev\web.config
…\DNNDev\ web.debug.config
…\DNNDev\ web.release.config
…\DNNDev\ DesktopModiules\<module 1 name>.csproj (no web.config)
…\DNNDev\ DesktopModiules\<module 2 name>.csproj (no web.config)

I still have the VS designer problem of not recognizing the Telerik prefix tag because it seems the designer looks to the local project for its web.config and not the startup project.  The current work around is to add a @ Register tag to each acsx file that needs a Telerik control.  I would like to put a link in each VS project pointing to the web.config file in the virtual folder DNNDev  but I can’t seem to do that.  You have to add an actual file to each project which chokes IIS.

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

0
Sebastian
Telerik team
answered on 07 Jan 2011, 10:34 AM
Hello Ed,

Thank you for posting your solution in this public forum thread - thus you can help other people who are looking for a similar solution. Your Telerik points have been updated for the involvement.

Best regards,
Sebastian
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Ed
Top achievements
Rank 1
answered on 18 Jan 2011, 07:56 PM
Tip.  Using the Telerik Upgrade Wizard or Project Configuration creates a new web.config in the project folder.  If you have other web.config files in the virtual directory path this error will occur.  The solution is to delete the newly created files.
Tags
General Discussions
Asked by
Ed
Top achievements
Rank 1
Answers by
Bodevain Svensson
Top achievements
Rank 1
Ed
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or