Click to See Complete Forum and Search --> : Use of subfolders in ASP.NET


anynick
01-28-2008, 11:30 AM
Beginners question. My environment is XP Pro with IIS 5 and .NET 2.0, using VWD Express, amongst other tings.

When I develop in ASP, my folder structure is:
C:\Programming\ASP
This is an IIS virtual directory and application called ASP.

Then subfolders e.g.
c:\Programming\ASP\TestSite1
No virtual directory or anything for this in IIS. So http://localhost/ASP/TestSite1 in the browser displays a default.asp in that subfolder.

And so on, for as many subfolders as I like, which is many.

I would like to replicate this arrangement with ASP.NET e.g.
c:\Programming\AspNet (as the IIS virtual directory and application)
c:\Programming\AspNet\TestSite3
and so on.

But ASP.NET wants to find a web.config in the folder that is the base virtual directory (so c:\Programming\AspNet), else it throws errors.

I could set this up and just put test files in the subfolders, but then the web.config in the base folder will start to accumulate stuff from whatever 'sites' I develop in the subfolders, and I think must eventually get confused.

Or I could set each subfolder up as its own virtual directory in IIS, but that will be an awful lot of virtual directories (perhaps this is the only sensible answer).

Can anyone suggest a way of setting things up so that I can operate with ASP.NET like I always have with ASP?

handyman_994
06-17-2008, 01:46 PM
What a Pain in the Arse!

So I just went through this because I have multiple sites on Network Solutions and I am unable to controll creating a new IIS virtual directory, but I figured out all my problems at least.

You hit it on the nose that you need keep the Web.Config file in the root virtual directory.

Next step is to use this to controll the various settings for each of your sites.
Edit your web config with location path within the <configuration> tag.
:)
example...
<configuration>
<location path="defaultPwd">
<appSettings>

The next error you will get is that your code behind will fail. :mad:
Something like

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'DefaultPwdEdit._Default'.

Source Error:


Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DefaultPwdEdit._Default" %>

End Error :mad:


So if you published the app you can copy the bin directory to the IIS root as well and this error will go away.

:)

So it's working for me with two different sites. I just think the bin directory and the Web.config file will continue to grow, but oh well.