Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 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