Developer forum

Forum » Development » Adding a folder outside of /Files and getting access

Adding a folder outside of /Files and getting access

Jan Sangill
Reply

Hi,

I had a folder in /Files/FOLDER. I had no trouble accesing this via HttpContext.Current.Request.MapPath()

I then need to move this FOLDER outside of /Files, so its not in the backend when loading filemanager. But now it fails.

How would I go about that?

before:

 string rootPathAgenda = "/Files/FOLDER/";
now:
 string rootPathAgenda = "/FOLDER/";

And it fails


Replies

 
Nicolai Pedersen
Reply

Hi Jan

Could you maybe say what error you get and where you have moved your /Folder?

Nicolai

 
Jan Sangill
Reply

Hi Nikolai,

No error received. Simply just a folder not found returned.

The Folder is moved outside of /Files. So it is in a way outside of the actual website. This is done so the file manager will not index the folders, takes to much.

/Files will be the root. I have moved it out. See attachment.

folder.jpg
 
Nicolai Pedersen
Reply

Hi Jan

I do not understand your issue.

Can you specify what you do and how it looks (screendump) when you do it? You have some code in the first thread - what is that. Is it the code that is not working, or when you click a link?

 
Jan Sangill
Reply

string rootPathAgenda = "/Edoc/Dagsordenspublicering";

...

String pathToXml = rootPathAgenda + edocAgendaDr["PathToXml"].ToString();

 //check if file exist
bool fileExist = File.Exists(HttpContext.Current.Request.MapPath(pathToXml));
//load the document if it exist
if (fileExist){

}

This is the code that does not work.

if the rootPath is this instead:

string rootPathAgenda = "/Files/Edoc/Dagsordenspublicering";

It works.

Hopes this clears my message up:>

 

 

 

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Jan

It helps a bit - you write "This is the code that does not work" - what does that mean? What do you expect to happen - and what happens? How can you see it "does not work" - do you get an error, a list of other files or how does it show?

Basically I am quite sure that your "Edoc" folder is not in the root of you website in IIS. From your dump I can see the folder "Files" - that is probably a virtual directory in IIS and not placed physically in the root of the website home directory. So you have to either place /Edoc in the physical home directory or create a virtual directory that points to the Edoc folder.

BR Nicolai

Votes for this answer: 1
 
Jan Sangill
Reply

Hi Nikolai.

It was outsode of the virtual directory. And you were right. I just had to create a new one. This solved it. THX!

 

You must be logged in to post in the forum