473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

save as dialog and shered directory rights

sorry for my bad english

when I fire up (from my c# code) a standard "file - save as "
dialog, and when chosen location is a shered local network
directory, where I do have rights to create and modify files,
but I do not have rights to delete one,

(and do save as with my filename)

then this standard windows dialog seem to create empty
file (size 0 bytes), with my filename (IT IS WEIRD), and then
try to delete it - and because of absence of rights to delete
fails the whole simple operation (there is a box
with message cannot delete file )

My question is - what is about that? and the second
and more important - where in dotnetframework
I will find a method which let me to test which rights
(to file operations in selected directory) I do have
(so I cauld check it before I try to call this
save as file dialog wchih in other case fail
operations I try to do (I mean save file)
(or yet better how to avoid this windows bug and
save my file in such directory)
T I A

kenobi

Jul 30 '07 #1
3 2574
Koliber (js) wrote:
sorry for my bad english

when I fire up (from my c# code) a standard "file - save as "
dialog, and when chosen location is a shered local network
directory, where I do have rights to create and modify files,
but I do not have rights to delete one,

(and do save as with my filename)

then this standard windows dialog seem to create empty
file (size 0 bytes),
The SaveFileDialog does not create a file. It only returns a filename,
for a file that may or may not exist. So if a file is being created,
it's your own code doing it.

with my filename (IT IS WEIRD), and then
try to delete it - and because of absence of rights to delete
fails the whole simple operation (there is a box
with message cannot delete file )
Well, if you have sufficient privileges to create a file but not to
delete files, then yes...you may wind up creating a file that you can't
delete.

Why the file is 0 length, I can't say. If you actually have the
appropriate rights to create and then append to files in that directory,
you should be able to write new data to the file. There is probably
something else you're doing wrong that you haven't explained yet.
My question is - what is about that?
What is about what?

and the second
and more important - where in dotnetframework
I will find a method which let me to test which rights
(to file operations in selected directory) I do have
You should look at the stuff supporting "access control lists", or ACL.
(so I cauld check it before I try to call this
save as file dialog wchih in other case fail
operations I try to do (I mean save file)
(or yet better how to avoid this windows bug and
save my file in such directory)
Why do you say this is a Windows bug? Windows is doing exactly what you
tell it to. If you don't like it doing that, then don't tell it to do that.

If the above does not give you enough information to fix your code, you
should post a concise-but-complete sample of code that reliably
reproduces the problem (given an appropriately-configured directory on
the disk, of course...I realize you can't post the directory, but it
should be easy enough to replicate, if you provide exact details of the
security settings on the directory for the user in question).

Pete
Jul 30 '07 #2
Peter Duniho wrote:
Why the file is 0 length, I can't say. If you actually have the
appropriate rights to create and then append to files in that directory,
you should be able to write new data to the file. There is probably
something else you're doing wrong that you haven't explained yet.
And just to clarify: in Windows, the right to create a file or modify it
is not the same as the right to append to a file. So since your file is
only 0 length, I suspect that you don't actually have the "append data"
right to the directory (and thus new files created in the directory).

You should be getting an exception if your file writing fails though.
If you look at the exception, it should give you some clues as to what's
actually going on.

Pete
Jul 30 '07 #3
Nicholas Paldino [.NET/C# MVP] wrote:
>The SaveFileDialog does not create a file. It only returns a filename,
for a file that may or may not exist. So if a file is being created, it's
your own code doing it.

This isn't true.
See...I told you I wasn't always 100% correct.

Note, however, that the behavior the OP is seeing is strictly due to the
permissions set on the directory. Normally, the test file is deleted
before the dialog returns control to the calling code. For all intents
and purposes, it doesn't create a file, as far as the calling code is
normally concerned.

But because the OP doesn't have rights to delete the file, the test file
remains.

In any case, presumably the OP would have created the file anyway, and
presumably the OP would have tried to write to the file anyway, so I
still say the only way for what they are describing to happen is for
them to not have append and delete rights to the directory in which they
are trying to create the file.

Still not a Windows bug, and still addressable in exactly the way I
described (ie check the access control list for the directory first).
Even if they disable the "test file" behavior in SaveFileDialog, they
will run into the same problem once they actually try to do something
with the filename (that is, try to write to the file).

If the OP does not intend to try to create a file, then the
SaveFileDialog isn't appropriate and I would recommend not using it.

Pete
Jul 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Martin | last post by:
Again drawing on the groups experience:- 1. For general file opening and file saving, using VB6, are there any issues with using the FileOpen and FileSave Common Dialog Boxes? 2. Is using the...
3
by: bbxrider | last post by:
running win2k adv server/ iis5.0 trying to setup on my web page where browsers can download a file, an .xls so been trying to figure out with a download 'link' what invokes the standard ms file...
2
by: Pat Richey | last post by:
i'm trying to make an open and a save file dialog that allows you to open/save various formats, but when you change the extension you want to filter the file list disappears until you leave the...
7
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a...
0
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
3
by: B-Dog | last post by:
I'm checking some files to see if the filenames are in a certain format and if not I want to pull up a dialog box that gives me a save as with the file that is in question. I have all the files in...
0
by: thomasp | last post by:
Wrong title should be File Save Dialog. I have a VB2005 program that has to import data from a 3.5 floppy drive and USB drives. I use a file open dialog to choose the file, works great. The...
0
by: Tim Golden | last post by:
gopal mishra wrote: There are several ways to display a "Save As" dialog. Can you post the code you're using so we can see what you're doing, please? TJG
3
by: =?Utf-8?B?U2hhbG9t?= | last post by:
I have installed iis 7 on my win vista home premium Sony Vaio laptop, and then tried executing downloaded sample working asp scripts in the wwwroot directory to try out. The first asp script...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.