Solved

Fileupload works but what to do with folders with special permission?

Posted on 2013-01-12
4
283 Views
Last Modified: 2013-01-14
I'm using a Telerik file upload control. This works but we came across an erorr:

"The network path is not found".

After watching users upload file, we noticed the person who was getting this error had the file in a folder with special permissions. This is what the user said...

" that folder it is saved on has special permissions as to accessibility"

And when the user moved the file to a public folder, that's when the upload worked
How can I account for this in the code? Anyway to detect the folder has special permissions and ask the user to move the file to another folder?
0
Comment
Question by:Camillia
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
sognoct earned 500 total points
ID: 38771468
Security namespace is what you are looking for
sample here :
 var permissionSet = new PermissionSet(PermissionState.None);    
 var writePermission = new FileIOPermission(FileIOPermissionAccess.Write, filename);
 
permissionSet.AddPermission(writePermission);
if (permissionSet.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet)) {
 // can upload 
}
else 
{
// you are not allowed to write on the folder 
}

Open in new window

0
 
LVL 7

Author Comment

by:Camillia
ID: 38772004
thanks, let me try
0
 
LVL 7

Author Comment

by:Camillia
ID: 38772039
Since I'm uploading, should I change the code to
var readPermission = new FileIOPermission(FileIOPermissionAccess.Read, file.FileName);

Read...instead of write?
0
 
LVL 9

Expert Comment

by:sognoct
ID: 38773698
msdn states :

Read: Read access to the contents of the file or access to information about the file, such as its length or last modification time.
Write: Write access to the contents of the file or access to change information about the file, such as its name. Also allows for deletion and overwriting.
Append: Ability to write to the end of a file only. No ability to read.
PathDiscovery: Access to the information in the path itself. This helps protect sensitive information in the path, such as user names, as well as information about the directory structure that is revealed in the path. This value does not grant access to files or folders represented by the path.

so ... if you have to read the file from the special folder for uploading in another site yes is reading

if you have to write the file in the special folder you have to check for writing
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sort GridView by ID Descending 1 18
Input parameteres to DragOver 2 20
looking for an ASP.net report designer 4 13
reading excel file in .net 2 19
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 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