Solved

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

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 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