Re: StreamWriter causes SecurityException when attempting to write to network drive..need help

From: Nicole Calinoiu (calinoiu)
Date: 08/22/05

  • Next message: Paul Clement: "Re: Can't determine if a file exists"
    Date: Mon, 22 Aug 2005 11:58:10 -0400
    
    

    <LordHog@hotmail.com> wrote in message
    news:1124470446.799207.115890@z14g2000cwz.googlegroups.com...
    > Nicole,
    >
    > Since I probably will not be able to accomplish executing the
    > application from a network and then write a report file to a network
    > drive, how do I go about checking before hand if the application has
    > security permission to open then write to a file?

    The most suitable approach would probably be to demand the necessary
    FileIOPermission in your code, presumably when your application loads. (I'm
    guessing that you'll probably want to demand unrestricted FileIOPermission
    given that it sounds like you want the user to be able to save to any local
    or network location at any time.) Just be careful to call into a separate
    method to make the demand since the Demand method only evaluates the higher
    level callers, not the method from which the Demand call itself is made.

    Just so you know, it's also possible to prevent the loading of your
    application if it does not have the appropriate permissions. Since you'll
    presumably want to actually run the assembly in order to display a custom
    message to the users in case of missing permissions, this probably isn't the
    approach you'll want to take. However, just in case you would prefer it for
    some reason, the basic approach is to add a "request minimum" security
    attribute at the assembly level. e.g.:

    [assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted =
    true)]

    >
    >>you've probably managed to forget the pain of it all over time...
    >
    > Oh, no. I relive the frustration from time to time during sustaining
    > activites. ;) There are times when I think it would be cool to be an
    > applications programmer, but then again writing low level code for the
    > embedded world has its advantages. Then again, getting the a low level
    > driver working correctly can get frustrating also. Just the every day
    > activity of a software person.
    >
    > Mark
    >


  • Next message: Paul Clement: "Re: Can't determine if a file exists"

    Relevant Pages

    • Re: udev sysfs docs Re: State of devfs in 2.6?
      ... > And if you want to run this way with udev, set it up so device nodes ... I'm swapping over a multi-route network where the backup link is ... /etc/modprobe.conf method of loading whole modules on demand. ... A demand-paged module retains a reference to the filesystem it is ...
      (Linux-Kernel)
    • Re: Symbols
      ... in English without processing symbols? ... use the word symbol for talking about the low level ... Thus a network may use symbols but the ...
      (comp.ai.philosophy)
    • Re: BT clueless
      ... the UK's telecomms network: ... and many have called for an urgent fibre upgrade. ... BT has argued that with costs of up to £15bn to roll out such a network ... it needs to be convinced of demand and have assurances from the ...
      (uk.telecom.broadband)
    • Re: Help--Missed Jerico Episode on April 18th
      ... The On Demand menu seems to give me choices geared only ... Step-by-step instructions greatly appreciated. ... Network or FX as several network shows are to give a regular viewer a ...
      (rec.arts.tv)
    • Re: Hey, folks...I do post. How about a net sec technique revisit?
      ... do it in an IP network. ... 1980s about the desirability of building net encryption drivers to ... intercept net traffic at pretty low level and encrypt or at least ... I never built such a driver, ...
      (comp.os.vms)