954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Access folder+files located outside webfolder

Dear all,

How do I access folder+files is located outside webfolder ?
My Intranet application website address is http://160.115.30.20/BMI
and physical folder in server is C:\Inetpub\wwwroot\BMI.
Folder I want to acess is located in C:\Inetpub\wwwroot\Documents.

Now, The folder is in webfolder. I want to move it to outside webfolder to make it simple when backup programs or documents.

Thanks,

Kusno.

Kusno
Junior Poster
191 posts since Aug 2007
Reputation Points: 11
Solved Threads: 17
 
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<script Language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {

	// path to directory
	string strPath = "E:/users/john/personal/files/"; 
	
	// create an instance of the DirectoryInfo object
	DirectoryInfo objTestDirectory = new DirectoryInfo(strPath);	

	if(objTestDirectory.Exists) {
		output.Text = "Yes, the directory <b>" + strPath + "</b> exists.";
	} else {
		output.Text = "No, the directory <b>" + strPath + "</b> does not exist.";
	}
}
</script>

<html>
<head></head>
<body>
<asp:label id="output" runat="server" style="font: 14px, Arial" /> </body> </html>
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<script Language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {

	// path to the file 
	string strFilePath = "E:/users/john/personal/files/Test_Document.doc"; 

	// create an instance of the FileInfo object
	FileInfo objTestFile = new FileInfo(strFilePath);	

	if(objTestFile.Exists) {
		output.Text = "The file <b>" + strFilePath + "</b> was found. Here is more information: ";
		output.Text += "Name: " + objTestFile.Name + ""; 
		output.Text += "Location: " + objTestFile.FullName + ""; 
		output.Text += "Created on: " + objTestFile.CreationTime + ""; 
		output.Text += "Last modified on: " + objTestFile.LastWriteTime + ""; 
		output.Text += "File size (in bytes): " + objTestFile.Length.ToString() +
"";				
		output.Text += "Extension: " + objTestFile.Extension;
	} else {
		output.Text = "Sorry, the  file <b>" + strFilePath + "</b> was not found.";
	}	
}
</script>
<html>
<head></head>
<body>
<asp:label id="output" runat="server" style="font: 14px, Arial"/> </body> </html>
serkan sendur
Postaholic
Banned
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
 

Dear Serkan Şendur,

Thanks for you reply.
Sorry, I think I did not give clearly question to all members.

In my folder there are pdf file and images file.
Users upload files from their local drive to that folder and if users want to see those file
I can use Response.Redirect command.

Thanks,

Kusno

Kusno
Junior Poster
191 posts since Aug 2007
Reputation Points: 11
Solved Threads: 17
 

one user email me about further explanation to this problem. you can access any file or folder on the server as long as you have the appropriate ntfs and share permissions. these permissions must be granted to ASP.NET user.

serkan sendur
Postaholic
Banned
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You