473,778 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2608
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
16224
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 FileOpen and FileSave Common Dialog Boxes the best way to go in general? 3. For Most of my projects I will be using the same types of data input form and report output form, as discussed here recently. Also, the files that are
3
10802
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 save dialog, hopefully without using vbscript other web pages i have seen have a simple link such as : <a href="someDir/someFile.xls">Download</a> when i used that, it just opens the spreadsheet and actually allows me to use the spreadsheet...
2
2643
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 current directory. here's the code for the save box: SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Portable Document Format (*.pdf)|*.pdf" + "|Encapsulated Postscript (*.eps)|*.eps" + "|Bitmap (*.bmp)|*.bmp" + "|JPEG...
7
3706
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 satisfactory answer (check your browser) so now that I've had the time to set up a reasonable little test that I can post somewhere, I'll try again. The app I've written has three ASPX pages. One is a combined page which writes a little text...
0
2979
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 entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it. ...
3
2553
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 a certain directory and if it doesn't meet my criteria then I want to do a "save as" to a different location. How can I do that. I can't seem to get the save as dialog to grab the filename of the file in question and ask for a place to save it....
0
1369
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 problem occurs the next time I wish to open a file. If the last import was done from a floppy drive the program looks for a floppy drive first and if it has been removed I get an error. While I could just catch the error, I would rather know how...
0
177
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
7094
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 opened fine. When I tried to click the link from the first asp script calling a second asp script, it just goes into a repeating dialog box, asking "Do you want to open or save this file", but without opening or executing the script, even though I...
0
9628
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10292
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10122
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7471
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.