| | |
IIS .NET2 virtual directory not working
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2005
Posts: 107
Reputation:
Solved Threads: 3
•
•
•
•
is login.aspx set as the login page in your web.config ?
also, have you used a location section to set authentication properties for the virtual directory?
Also no, I don't have a location section....in fact I don't think I know what it is.
Can you enlighten me?
Web Developer
When something seems too good to be true...it usually is
When something seems too good to be true...it usually is
<location> section in a web.config lets you set settings for subdirectories in applications, as web.config files are hierachical i.e you can have a web.config file ine ach directory, but the root directory by default overrides the sub directory configs. In your case looking at the stack, there is a call from a class called login.aspx.vb which seems to be performing a read operation on the txt file
If your app is using forms authentication and your web.config file is denying unauthenticated users access to your root directory, then it is possible that this setting is preventing access to your virtual directory. By adding
<locationpath="FCKeditor">
<system.web>
<authorization>
<allowusers="?"/>
</authorization>
</system.web>
</location>
that could in theory fix the problem
If your app is using forms authentication and your web.config file is denying unauthenticated users access to your root directory, then it is possible that this setting is preventing access to your virtual directory. By adding
<locationpath="FCKeditor">
<system.web>
<authorization>
<allowusers="?"/>
</authorization>
</system.web>
</location>
that could in theory fix the problem
•
•
Join Date: Jun 2005
Posts: 107
Reputation:
Solved Threads: 3
You're right about the class and the text file but it still won't work.
Putting the <location>-lines in the web.config only returns the well-know Runtime Error instead of the previous error message:
Does the machine.config matter in this?
Also I don't know if this is significant but the structure the web site is:
domain top level
-> asp.net application directory
-> -> this is where I'd like a virtual directory
My web.config now looks like this:
Any further ideas? :-|
Putting the <location>-lines in the web.config only returns the well-know Runtime Error instead of the previous error message:
•
•
•
•
To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
Also I don't know if this is significant but the structure the web site is:
domain top level
-> asp.net application directory
-> -> this is where I'd like a virtual directory
My web.config now looks like this:
ASP.NET Syntax (Toggle Plain Text)
<?xml version="1.0"?> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <appSettings/> <connectionStrings/> <locationpath="FCKeditor"> <system.web> <authorization> <allowusers="*"/> </authorization> </system.web> </location> <system.web> <identity impersonate="true"/> <compilation debug="true" strict="false" explicit="true"> <assemblies> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies> </compilation> <httpRuntime executionTimeout="120" maxRequestLength="20480"/> <pages> <namespaces> <clear/> <add namespace="System"/> <add namespace="System.Collections"/> <add namespace="System.Collections.Specialized"/> <add namespace="System.Configuration"/> <add namespace="System.Text"/> <add namespace="System.Text.RegularExpressions"/> <add namespace="System.Web"/> <add namespace="System.Web.Caching"/> <add namespace="System.Web.SessionState"/> <add namespace="System.Web.Security"/> <add namespace="System.Web.Profile"/> <add namespace="System.Web.UI"/> <add namespace="System.Web.UI.WebControls"/> <add namespace="System.Web.UI.WebControls.WebParts"/> <add namespace="System.Web.UI.HtmlControls"/> </namespaces> </pages> <authentication mode="Windows"/> <customErrors mode="Off" /> </system.web> </configuration>
Any further ideas? :-|
Web Developer
When something seems too good to be true...it usually is
When something seems too good to be true...it usually is
the location key should go after </system.Web>
and before </configuration>
the error message you have is probably because of the incorrect placing of the location tag
and before </configuration>
the error message you have is probably because of the incorrect placing of the location tag
I just looked at the code I posted it's missing spaces <locationpath should read:
<location path
and also <allowusers
should read <allow users
sorry about that, I pasted it from a web.config and this editor removed them
<location path
and also <allowusers
should read <allow users
sorry about that, I pasted it from a web.config and this editor removed them
•
•
Join Date: Jun 2005
Posts: 107
Reputation:
Solved Threads: 3
Don't worry about it 
I actually tried inserting the missing space in <location> mysel 'cause I though it didn't look right, but I gues I missed the one in "<allow>"...
Anyway, something did happen: the runtime error went away, and the initial error "Could not find a part of the path..." reoccured...
This is very frustrating. But I do appreciate your help, though, sedgey.
Can you think of anything else to try?

I actually tried inserting the missing space in <location> mysel 'cause I though it didn't look right, but I gues I missed the one in "<allow>"...
Anyway, something did happen: the runtime error went away, and the initial error "Could not find a part of the path..." reoccured...
This is very frustrating. But I do appreciate your help, though, sedgey.
Can you think of anything else to try?
Web Developer
When something seems too good to be true...it usually is
When something seems too good to be true...it usually is
One last stab at this, how are you reading the text file? using Server.MapPath? Try switching off your forms authentication and see if you can access the file by http,
http://yourdomain/virtialfolder/filename.txt
If you can then maybe you can stream the file by http instead of accessing it through the file system. I suspect that the problem lies in the fact that IIS virtual directories may only work for http and ftp only. Anyway, thats my last stab! or one last idea maybe to put these files in new root site of its own and use something like isapi_rewrite to proxy a path like:
http://yourdomain/virtualfolder to http://IPaddressOrDomainOfGlobalFiles
http://yourdomain/virtialfolder/filename.txt
If you can then maybe you can stream the file by http instead of accessing it through the file system. I suspect that the problem lies in the fact that IIS virtual directories may only work for http and ftp only. Anyway, thats my last stab! or one last idea maybe to put these files in new root site of its own and use something like isapi_rewrite to proxy a path like:
http://yourdomain/virtualfolder to http://IPaddressOrDomainOfGlobalFiles
Last edited by sedgey; Feb 10th, 2007 at 4:15 am.
•
•
Join Date: Jun 2005
Posts: 107
Reputation:
Solved Threads: 3
Yep, I can access the file by http - no problem.
In the class I'm referencing the file by
which also returns the correct physical path on the server....that's why I don't it.
The approach of using shared folders like this is used all over the server with "ordinary" asp-sites, so I know it works....just not the my .net2-app.
And I have to do it this way. Textfiles aren't the only files I'd like to access this way...shared app-classes too for one.
In the class I'm referencing the file by
ASP.NET Syntax (Toggle Plain Text)
request.physicalapplicationpath & "virtualfolder"
The approach of using shared folders like this is used all over the server with "ordinary" asp-sites, so I know it works....just not the my .net2-app.
And I have to do it this way. Textfiles aren't the only files I'd like to access this way...shared app-classes too for one.
Web Developer
When something seems too good to be true...it usually is
When something seems too good to be true...it usually is
•
•
Join Date: Jun 2005
Posts: 107
Reputation:
Solved Threads: 3
Hmmm....I found a way that works.
Initially I mapped the virtual directory and referenced it from the .NET class by physicalApplicationPath & "FCKeditor"....which didn't work. The .NET path output was the physical path of "domain directory"/FCKeditor.
I then left the virtual directory as it were, configured as an application, and reference the directory by Server.MapPath("FCKeditor")....and that works. When I debug it Server.MapPath("FCKeditor") returns the physical path of the virtual directory and the FCKeditor inside the application still works by referencing the source files by just "FCKeditor/".
So the HTML/js read from the virtual directory alright, and previously I etablished that vd has setup alright since I could directory browse it online, but the .NET-code won't allow direct references to the virtual directory.
I think I do see the logic...although somewhat fuzzy
NOTE: I deleted the <location> keys in web.config just as a test, and it still worked.
BUT that was only step 1/3. Now I want to virtually reference the shared classes as well the same way. So not I get a new error message that says (went back to the not-precompiled version):
Now this I can understand...but I don't know to fix it...yet
Initially I mapped the virtual directory and referenced it from the .NET class by physicalApplicationPath & "FCKeditor"....which didn't work. The .NET path output was the physical path of "domain directory"/FCKeditor.
I then left the virtual directory as it were, configured as an application, and reference the directory by Server.MapPath("FCKeditor")....and that works. When I debug it Server.MapPath("FCKeditor") returns the physical path of the virtual directory and the FCKeditor inside the application still works by referencing the source files by just "FCKeditor/".
So the HTML/js read from the virtual directory alright, and previously I etablished that vd has setup alright since I could directory browse it online, but the .NET-code won't allow direct references to the virtual directory.
I think I do see the logic...although somewhat fuzzy
NOTE: I deleted the <location> keys in web.config just as a test, and it still worked.
BUT that was only step 1/3. Now I want to virtually reference the shared classes as well the same way. So not I get a new error message that says (went back to the not-precompiled version):
ASP.NET Syntax (Toggle Plain Text)
The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [HttpException (0x80004005): The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported.] System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +3450907 System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125 System.Web.Compilation.BuildManager.CompileCodeDirectories() +525 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +448 [HttpException (0x80004005): The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported.] System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +57 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +612 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +456 [HttpException (0x80004005): The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3426855 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +149
Now this I can understand...but I don't know to fix it...yet
Last edited by madmital; Feb 10th, 2007 at 7:50 am.
Web Developer
When something seems too good to be true...it usually is
When something seems too good to be true...it usually is
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: Deleting duplicate fields
- Next Thread: how to create ms. word docs in asp.net
Views: 9464 | Replies: 23
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax alltypeofvideos anathor asp asp.net bc30451 bottomasp.net browser button c# c#gridviewcolumn checkbox child click commonfunctions compatible confirmationcodegeneration content contenttype courier css database datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownlist edit expose feedback flash flv form formatdecimal forms formview google grid gridview homeedition hosting iframe iis index javascript jquery list login menu microsoft migration mono mssql multistepregistration numerical object objects order panelmasterpagebuttoncontrols problem project ratings refer rotatepage save schoolproject search security serializesmo.table session silverlight smartcard sqlserver2005 suse textbox tracking typeof unauthorized update validation vb.net video view virtualdirectory vista visual-studio visualstudio web webarchitecture webdevelopemnt webservice xml youareanotmemberofthedebuggerusers





