Solved

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

Posted on 2013-01-12
4
264 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now