[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How do I store files outside of C# ASP.NET application root folder in IIS.

Posted on 2013-11-08
5
Medium Priority
?
4,911 Views
Last Modified: 2013-11-16
"../" style parent paths do not work
"~/" tildas  do not work as they only go to the app root also

It is important to not this WebApp is stored in a same named subfolder shown as bold.  
It is an MVC ASP.NET C# 4.0 database editing APP.
eg c:\inetpub\wwwroot\projectname\projectname

In the Root Folder I have a standard ASP.NET web application in Italics.
I need some advice or code on how to escape the application in the subfolder to store files in the true root folder.

My IIS version is 8 on an x64 machine.

Does this request have anything to do with "Double Escaping" that can be overridden in the request filtering? or is that unrelated.
I am interested in a web.config based solution if at all possible, in an attempt to overcome ever changing IIS security changes.
0
Comment
Question by:XGIS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39635368
The only way I know to accomplish this is to make a symbolic link to the parent folder from within the child folder. Then it appears as though the parent is a child of the child, but on the physical file system it is not. You can use the mklink utility for this.
0
 
LVL 7

Accepted Solution

by:
XGIS earned 0 total points
ID: 39639788
To overcome the issue of uploading ABOVE the APPLICATION ROOT Folder is very simple if you use Virtual Directories in IIS.
This example is created based on the ANM10 Generated Website being Nested in another website.
The reason for this is it gives me somewhere to put folders and files so I do not risk accidentally generating over my folders and files.
It also helps me to maintain a single folder in WWWROOT for all Website related tasks.
It is also a good place to store sensitive files such as the AGX which should NOT be located in the published website folder.

Related Posts:
Custom Image Upload Folders - Row_Inserting Event - viewtopic.php?f=45&t=33634
Increase Image - File Uploads to 100Mb - viewtopic.php?f=45&t=33638

The Goals:
1. Store Files in Folders Above the Application Root Folder; e.g. C:\inetpub\wwwroot\MainWebsite\YourCustomVDUploadFolder\
2. Manage Files elsewhere using a Virtual Directory in IIS here; e.g. C:\inetpub\wwwroot\MainWebsite\ANM10WebsiteAppRoot\
3. Enable complete site regeneration without risk of losing existing folder based data.
4. Cleaner, safer and faster delivery of presentation application eg ASP.NET
5. Static safe folder for server scheduled backups of data eg using BAT files etc

All code will be directed at the Virtual directory but all files will actually live in the physical folder above the application root.
There is need to even create the folder. If you do and you always regenerate using "Clear All" you would have to manually create it each time or code it to autogenerate.

1. Windows Explorer: Create this folder; e.g. C:\inetpub\wwwroot\MainWebsite\YourCustomVDUploadFolder"
2. IIS: Click on this folder e.g. C:\inetpub\wwwroot\MainWebsite\ANM10WebsiteAppRoot\
3. Right click to create the Virtual Directory folder e.g. "YourCustomVDUploadFolder" which simply points to the physical folder that in this case is one folder above the Application Root.

This is NOT limited to this structure or location, but the example was based only on my immediate needs.
Maybe you have an existing or separate website where the files need to be made available e.g D or E etc.
This is NOT limited to custom uploads referred to in the posts above. The same should be possible for standard ANM10 file upload to folder based projects.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39640014
I try to minimise 3rd party dependencies and utilise existing infrastructure to avert breakdowns
mklink is a utility provided by Microsoft, and it comes already installed in Windows Server, so I wouldn't consider it a "3rd party" solution. But if you've got a working solution, then that is what counts  = )
0
 
LVL 7

Author Comment

by:XGIS
ID: 39640081
Hello kaufmed.. apologies for my bad choice of words... it should have been something like code dependencies.  Again thankyou for your time and i welcome your suggestions in the future.
0
 
LVL 7

Author Closing Comment

by:XGIS
ID: 39653041
Hello Kaufmed.. thankyou for your time..while your suggestion may have been suitable in some programming scenarios it was difficult to integrate as my IDE is restricted in what it can and cannot use. Similarly I try to minimise 3rd party dependencies and utilise existing infrastructure to avert breakdowns.  IIS Virtual directories were all that was required to overcome application limitations and IIS security issues.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question