Add Standalone ASP.Net Application Into Existing ASP.Net Website - not working - asp.net

I have an asp.net '4.5' site (Orion Solarwinds) and I would like to add functionality. This can be done with a virtual directory, but adding anything to that folder will cause a recompile and interrupt service to the user.
It should be possible(and done it many times before) to 'just' add a application. So I should be able to use a separate application pool.
BUT what happens is that even with a index.html file in an empty application with a web.config in there, it still seems to inherit from the host webconfig. Thus this is not a Standalone ASP.Net Application in an existing website. I have tried to decouple this basic application - no joy. How can I fix this?

You can try using inheritInChildApplication by wrapping sections you don't want to inherit in host webconfig with this:
<location path="." inheritInChildApplications="false">
There's more details in this other thread

Related

ASP.NET, two Web.Config

I have a .NET application with all the aspx pages and the main web.config in the root folder but I now have a situation where I need a portal like section for other users. I have created a new folder with it's own unique aspx pages and a second web.config.
I especially need a second web.config to have the <authentication> with a <forms loginUrl="" defaultUrl="> for this portal section and a <authentication> too.
I have implemeted this second web.config in the way I created the first and I am getting this error message:
It is an error to use a section registered as allowDefintion='MachineToApplication'
beyond application level. This error can be caused by a virtual directory not being
configured as an application in IIS.
Now I think the main web.config file is conflicting with the this second webconfig in it's folder. I'm not sure how to fix this, I have seen theories on how this works but no solid code.
Thank you for any suggestions and your time, it is much appreciated.
In IIS, create a virtual directory, under your main application. The local web.config will overide stuff in your main web.config, but still use you main web.config for everything else (i.e. ConnectionStrings, encoding, etc.).

Configure URL in IIS

I have an existing DNN site set up in IIS and I want to link to another ASP.NET application in a separate folder. I want to maintain the same domain URL as follows:
http://dnn9.dnndev.me/otherapplication
Can anyone point me in the right direction?
UPDATE
Currently, the main DNN site is set up as its own site in IIS (not under Default Web Site)., with its own App Pool. I tried adding a virtual directory to the main DNN site, pointing to the other application folder. It gives a 404. I added <location path="." inheritInChildApplications="false"> around the system.web section of the DNN site web.config. My main DNN site is set up as "dnn9.dnndev.me". I'm wondering if the "dnn9" subdomain on my local is causing an issue?
The other application is added as an application under Default Web Site in IIS, with its own App Pool.
I just created two test websites "Test1" and "Test2". I placed both of these under the "Default Web Site" node in IIS and added a virtual directory to Test1, pointing to Test 2 and it worked. So the main difference between this test scenario and my actual setup is that DNN is set up in IIS as a standalone app, not under the "Default Web Site" node in IIS.
How can I get this to work?
I was able to make the following scenario work.
DNN running in a website in IIS called "DNNDEV.ME" with the URL binding being set for DNNDEV.ME. Location of the DNN files c:\websites\dnndev.me
Created a new "APPLICATION" under the DNNDEV.ME site, using the same DNNDEV.ME application pool. I pointed that application's root to the folder c:\websites\newapp\
Modified the DNN web.config file to wrap <location path="." inheritInChildApplications="false"> around the system.webServer node
With that functioning I added a file called sample.aspx, with the contents being
This is a test.
The site loaded fine, and DNN continued to function as well. I added a sample web.config into the c:\websites\newapp\ folder from https://www.daniellittle.xyz/example-web-config-files-3-5-and-4-5/#Framework451 just to check that out, and the site continued to function as well.
I added dnn9.dnndev.me to my bindings on the DNNDEV.ME website as well, and it continues to function without problems.
Only real difference I can see from what I did, and you said you tested, is that I made an APPLICATION not a Virtual Directory in IIS for /NewApp/

IIS website paths behave different when accessing the site from outside the network

As the title states, I get different behavior on my website when I try to access it from the internet, as opposed to accessing it from the local network, and I cannot figure out why. I know it is because IIS is trying to serve me content from the parent application, but I don't know how to fix it.
Let me try explain: I have a website (not a web application) that I deployed to an existing IIS site, and then converted it to an application. If I access the website from the local network (<hostname>/path/to/site.aspx) then everything works fine, but when I try to access the site from the internet (<domain.name>/path/to/site.aspx) then it breaks, and I have the mappings set up correctly for the domain (it works on the parent application).
Initially it couldn't access the Site.Master page, saying the file cannot be found at <Site Parent Folder>/Site.Master (Instead of <Site Parent Folder>/<Current App>/Site.Master), so I had to change the master page reference on the ASP page from ~/Site.Master to just Site.Master And that seems to have worked for the master page only. It now gives me an error about being unable to find my classes in the App_Code directory (The type or namespace name 'MyClass' could not be found. Are you missing a using directive or an assembly reference?) so I'm suspecting that it is still trying to reference those from the parent directory.
Any ideas on how I can fix it so that it references the current application's directory instead of the parent app's directory?
Thanks in advance.
Ensure that your deployed website is running as a sub-applicaiton under main IIS site.
In your main IIS website update web.config and wrap system.web section with location element with inheritInChildApplications set to false
<location path="." inheritInChildApplications="false">
<system.web>
…
</system.web>
</location>
You can read more about it here

Visual Studio Application looking for login.aspx

I have an asp.net version 4 web application that runs in IIS. It has worked well, but suddenly is looking for login.aspx.
I don't have and never have had login.aspx in the application. Why would it look for it now, and how do I fix it?
If this site is virtually a child of another site, then that could be the problem.
web.config files have a virtual inheritance hierarchy. The definition of the login page could be coming from a site higher in the virtual hierarchy.
If the higher web.config were to introduce a different login page, then that would affect your site. You would then have to use your web.config to override the changes made in the higher web.config.
I'm not too sure if you've found the answer already but if you don't need authentication in your website then set the authentication mode to none. Like below
<authentication mode="None"/>

ASP.NET application in virtual folder uses web.config of application in root folder of website

I have several ASP.NET applications in virtual folders (already configured as applications, and with different application pools), but I want to install another ASP.NET application that will redirect to one of the virtual folders according to some criteria (from database and cookies).
All the applications in the virtual folders work fine, but if I install the root application, then I get some errors about duplicate web.config settings.
A workaround would be to create yet another virtual folder for the redirecting application, and use HTML redirection on the root site.
However, I would like to know if it is possible for a web application in a virtual folder to skip the website-root web.config in the .config hierarchy.
Thanks,
Luis Alonso Ramos
One option is to move all the settings of the web.config to a location path where you use the inheritInChildApplications attribute so that those settings are only applied for the parent application and not child applications, something like:
<location inheritInChildApplications="false">
... move all your settings here...
</location>

Resources