IIS .NET2 virtual directory not working

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2005
Posts: 107
Reputation: madmital is an unknown quantity at this point 
Solved Threads: 3
madmital madmital is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #11
Feb 8th, 2007
Originally Posted by sedgey View Post
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?
No login.aspx isn't configured as the login page. But that's not really mandatory, is it?
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
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 130
Reputation: sedgey is on a distinguished road 
Solved Threads: 8
sedgey's Avatar
sedgey sedgey is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #12
Feb 8th, 2007
<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
David Ridgway: so little daylight, too much caffeine
MCSD MCAD MCSE
http://web2asp.net
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 107
Reputation: madmital is an unknown quantity at this point 
Solved Threads: 3
madmital madmital is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #13
Feb 9th, 2007
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:
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".
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:

  1. <?xml version="1.0"?>
  2. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  3. <appSettings/>
  4. <connectionStrings/>
  5. <locationpath="FCKeditor">
  6. <system.web>
  7. <authorization>
  8. <allowusers="*"/>
  9. </authorization>
  10. </system.web>
  11. </location>
  12. <system.web>
  13. <identity impersonate="true"/>
  14. <compilation debug="true" strict="false" explicit="true">
  15. <assemblies>
  16. <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  17. <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
  18. </compilation>
  19. <httpRuntime executionTimeout="120" maxRequestLength="20480"/>
  20. <pages>
  21. <namespaces>
  22. <clear/>
  23. <add namespace="System"/>
  24. <add namespace="System.Collections"/>
  25. <add namespace="System.Collections.Specialized"/>
  26. <add namespace="System.Configuration"/>
  27. <add namespace="System.Text"/>
  28. <add namespace="System.Text.RegularExpressions"/>
  29. <add namespace="System.Web"/>
  30. <add namespace="System.Web.Caching"/>
  31. <add namespace="System.Web.SessionState"/>
  32. <add namespace="System.Web.Security"/>
  33. <add namespace="System.Web.Profile"/>
  34. <add namespace="System.Web.UI"/>
  35. <add namespace="System.Web.UI.WebControls"/>
  36. <add namespace="System.Web.UI.WebControls.WebParts"/>
  37. <add namespace="System.Web.UI.HtmlControls"/>
  38. </namespaces>
  39. </pages>
  40. <authentication mode="Windows"/>
  41. <customErrors mode="Off" />
  42. </system.web>
  43. </configuration>

Any further ideas? :-|
Web Developer
When something seems too good to be true...it usually is
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 130
Reputation: sedgey is on a distinguished road 
Solved Threads: 8
sedgey's Avatar
sedgey sedgey is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #14
Feb 9th, 2007
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
David Ridgway: so little daylight, too much caffeine
MCSD MCAD MCSE
http://web2asp.net
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 107
Reputation: madmital is an unknown quantity at this point 
Solved Threads: 3
madmital madmital is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #15
Feb 9th, 2007
moved the key, same result: runtime error.
Web Developer
When something seems too good to be true...it usually is
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 130
Reputation: sedgey is on a distinguished road 
Solved Threads: 8
sedgey's Avatar
sedgey sedgey is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #16
Feb 9th, 2007
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
David Ridgway: so little daylight, too much caffeine
MCSD MCAD MCSE
http://web2asp.net
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 107
Reputation: madmital is an unknown quantity at this point 
Solved Threads: 3
madmital madmital is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #17
Feb 10th, 2007
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?
Web Developer
When something seems too good to be true...it usually is
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 130
Reputation: sedgey is on a distinguished road 
Solved Threads: 8
sedgey's Avatar
sedgey sedgey is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #18
Feb 10th, 2007
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
Last edited by sedgey; Feb 10th, 2007 at 4:15 am.
David Ridgway: so little daylight, too much caffeine
MCSD MCAD MCSE
http://web2asp.net
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 107
Reputation: madmital is an unknown quantity at this point 
Solved Threads: 3
madmital madmital is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #19
Feb 10th, 2007
Yep, I can access the file by http - no problem.
In the class I'm referencing the file by
  1. request.physicalapplicationpath & "virtualfolder"
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.
Web Developer
When something seems too good to be true...it usually is
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 107
Reputation: madmital is an unknown quantity at this point 
Solved Threads: 3
madmital madmital is offline Offline
Junior Poster

Re: IIS .NET2 virtual directory not working

 
0
  #20
Feb 10th, 2007
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):

  1. The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported.
  2. 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.
  3.  
  4. Exception Details: System.Web.HttpException: The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported.
  5.  
  6. Source Error:
  7.  
  8. 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.
  9.  
  10. Stack Trace:
  11.  
  12.  
  13. [HttpException (0x80004005): The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported.]
  14. System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +3450907
  15. System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125
  16. System.Web.Compilation.BuildManager.CompileCodeDirectories() +525
  17. System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +448
  18.  
  19. [HttpException (0x80004005): The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported.]
  20. System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +57
  21. System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +612
  22. System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +456
  23.  
  24. [HttpException (0x80004005): The path '/ncdnm/App_Code/' maps to a directory outside this application, which is not supported.]
  25. System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3426855
  26. System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
  27. 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
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the ASP.NET Forum


Views: 9464 | Replies: 23
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC