How to deploy another web application under DNN as virtual directory

Here is the scenario that this post is about. You have an existing DotNetNuke (DNN). Now you have to configure a new ASP.Net web application under this site as virtual directory. So you follow the standard procedure of creating a new virtual directory under your parent DNN site and point it to the location where the new web application's files are. Try to access this site and you will run into the following error.

Server Error in '/DNN53/ProductsSearch' Application.

Configuration Error 
Description: An error occurred during the processing of a configuration 
file required to service this request. Please review the specific error details
below and modify your configuration file appropriately. 

Parser Error Message: The code subdirectory '/DNN53/ProductsSearch/App_Code/IFrame/' 
does not exist.

Source Error: 

Line 168:      -->
Line 169:      <codeSubDirectories>
Line 170:        <add directoryName="IFrame" />
Line 171:        <add directoryName="Survey" />
Line 172:        <add directoryName="XML" />

Source File: C:\Projects\DNN\DNN_V531\Install\web.config    Line: 170

Now you are wondering what does these folders and files have to do anything with your web application that is hosted under DNN site. The thing that you need to understand is that when you are hosting a child application under parent ASP.Net application, it inherits web.config settings from all the parents as well. So in this case your application is inheriting DNN related settings as well. I have some one suggesting to add these missing folders in your new application as well. Next thing you will run into is that your site is complaining about missing DNN related assemblies.

The solution to this problem is not copy DNN assemblies or mimic the folder structure in your application as well. Because now you have added a very strong dependency on parent application. There is a very simple and elegant solution to this problem.

  • Open Web.config file of your parent DNN site.
  • Look for system.web entry in the file.
  • Enclose that whole section in location tag and set the attributes of that tag as below.
    <location path="" inheritInChildApplications="false">
  • By setting inheritInChildApplications to false you indicate to ASP.Net pipe line that any settings for the specified path and for the section are not to be propagated to the child application.

You can use this technique to restrict propagation on page by page or by folders etc.




-0.2 °C / 31.6 °F

weather conditions Clouds

Monthly Posts

Blog Tags