Configure URL in IIS - asp.net

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/

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.).

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

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

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

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>

How do you set handler mapping to a directory in IIS 6.0?

I have IIS 7.0 on my development machine and IIS 6.0 on my server. On my development machine I was able to set a handler map on a directory within my site called /ViewHtml/ and I mapped it to asp.net. In my global.asax I check the request sent to asp.net for /ViewHtml/ and I serve the appropriate html file(html version of a Doc, Power Point, or Excel file) located outside this apps virtual directory. I am doing it this way because all files are permission protected, we didn't want to put these files in are database due to scalability, and I need to hide the path to these file on the server. This all works in IIS 7.0 exactly how I would like it to. Although I have not been able to get my IIS 6.0 server configured to map all requests to that directory to asp.net.
Any ideas? Thanks Guys?
I set up a web application using the same configuration you're using and I'm also getting the 404. I don't know why it works in IIS 7, but here's what I had to do to fix it.
Create a class that implements the System.Web.IHttpHandler class. move the the code from Application_BeginRequest to your implementation of IHttpHandler.ProcessRequest.
Now you just have to register your HTTP handler with ASP.NET. To do so add an entry in your Web.config at /configuration/system.web/httphandlers.
Web.config Example:
...
<httpHandlers>
<clear />
<add verb="*" path="*" type="namespace.classname, assemblyname" />
</httpHandlers>
...
That entry is telling ASP.NET to handle HTTP requests with any extension and any HTTP method by running the code in your HTTP hander. Note that I'm also clearing all the previously definded handlers (defined in the machine's web.config).
Note that you will still need the Application Mapping configured in IIS.
If I understand the problem correctly, it sounds like you need add a "Wildcard Application Mapping" for your virtual directory. In other words, you want to forward all requests to any file extension to ASP.NET's ISAPI extension.
To do so, open the properties of your virtual directory. On the Virtual Directory tab (Home Directory tab if it's a web site), click the Configuration... button. Click the Insert... button next to the bottom list box in the dialog that shows up. In this dialog, choose "%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" as the executable and make sure to un-check "Verify that file exists" checkbox, since the files to be requested don't live in your virtual directory.
I hope this helps!
i think your problem is all about access policy , you have to make sure that the access policy is Read and not None , cz with None you have no permission to even read files from your website

Resources