Re: security permissions for creating a file

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



hi,

post the text of the exception.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



"Mark" <Scollop027@xxxxxxx> wrote in message
news:dco6ob$ig6$01$1@xxxxxxxxxxxxxxxxxxxx
> Hi Nicholas,
>
> I tried a console application and as admin I have no restriction in any
> directory.
>
> regards Mark
>
>
>
> "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> schrieb
> im Newsbeitrag news:eszHSt3lFHA.3256@xxxxxxxxxxxxxxxxxxxxxxx
>> Mark,
>>
>> You get this exception because you don't have rights to create or
>> open
>> the file in the directory that it is set in. You need to try and create
> the
>> file in a directory that you have rights to, or, if the file exists,
>> check
>> the rights on the file to make sure that you can open it for writing.
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>>
>> "Mark" <Scollop027@xxxxxxx> wrote in message
>> news:dco3i4$btq$01$1@xxxxxxxxxxxxxxxxxxxx
>> > Hello,
>> >
>> > in a simple console application I try to create a file with some code
>> > like:
>> >
>> > FileStream file = new FileStream("test.txt", FileMode.OpenOrCreate,
>> > FileAccess.Write);
>> > StreamWriter sw = new StreamWriter(file);
>> > sw.Write("Hello");
>> > sw.Close();
>> > file.Close();
>> >
>> > I will get an error System.Security.SecurityException
>> >
>> > Are there only one way to avoid this and how this can be done?
>> >
>> > Thanks and regards
>> > Mark
>> >
>> >
>>
>>
>
>


.



Relevant Pages

  • Re: ptwilliams?
    ... I'm wondering if this might be a User Rights Assignment issue similar to (if ... > password I tried to reset was a DC at a remote location. ... I'm glad Mark was able to help you!! ... >> logging into the console and getting a 'command completed successfully' ...
    (microsoft.public.win2000.active_directory)
  • Re: security permissions for creating a file
    ... got exception - I guess .NET told me that this application is not safe ... > a limited permission set. ... >> regards Mark ... >>> file in a directory that you have rights to, or, if the file exists, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: security permissions for creating a file
    ... got exception - I guess .NET told me that this application is not safe ... > a limited permission set. ... >> regards Mark ... >>> file in a directory that you have rights to, or, if the file exists, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: security permissions for creating a file
    ... > post the text of the exception. ... >> regards Mark ... >>> file in a directory that you have rights to, or, if the file exists, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: security permissions for creating a file
    ... > post the text of the exception. ... >> regards Mark ... >>> file in a directory that you have rights to, or, if the file exists, ...
    (microsoft.public.dotnet.languages.csharp)