Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-01-12
4
Medium Priority
?
313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
sognoct earned 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

618 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