Link to home
Start Free TrialLog in
Avatar of campinam
campinam

asked on

Asp.net web application access to containing site

I have a larger site on IIS and now I am planning to add an asp.net web application to one of its folders, like this:

FLD_ROOT
    FLD_TXT
    FLD_APP

where FLD_ROOT is the root of the larger site and FLD_APP is the folder where I plan to deploy the application. In addition, the site contains the FLD_TXT folder.

The application needs to read the text files in FLD_TXT when it starts. It is not possible to include those files with the application (for site maintenance reasons).

My question is, can my application access those files? They are not part of it, but still part of the site. If not, what would be a solution to grant access?
Avatar of Geoff Sutton
Geoff Sutton
Flag of Canada image

Map the files from site to site through the local file system if they are on the same server as it sounds like they are.  System.IO.file.read... should do it for you to retrieve the data then send it up however you want.
Avatar of campinam
campinam

ASKER

What do you mean by "map the files" (application is inside a larger site) -- I am a beginner with these things... So by default the app won't be able to read files from the containing site?
ASKER CERTIFIED SOLUTION
Avatar of Geoff Sutton
Geoff Sutton
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you much. Are there any security permissions I need to set for FLD_TXT? This folder is under the root of the larger site, the one that contains my application, but not within the application folder structure. Server is Windows Server 2019.
Just whichever security you would normally set.  Nothing fancy should be required unless your file permissions are blocking access.
So if I leave server security settings for FLD_TXT unchanged (the server default), then reading files in FLD_TXT from my application would work, right? The account that my application uses (the default, not sure which one that is) would then have permission to read files from FLD_TXT. And that's because FLD_TXT is part of the web site, even though it is not part of the application. Please confirm, or correct if I am wrong.
I believe that you are right.  You will, of course, have to experiment to get it 100% but it should work out as you have described.