Click here to Skip to main content
16,005,080 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataSet generator error Pin
Heath Stewart28-Jun-04 4:11
protectorHeath Stewart28-Jun-04 4:11 
GeneralRe: DataSet generator error Pin
Member 114126629-Jun-04 2:10
Member 114126629-Jun-04 2:10 
QuestionBest way to print an image that may be larger than one page? Pin
Pain_Elemental27-Jun-04 20:15
Pain_Elemental27-Jun-04 20:15 
AnswerRe: Best way to print an image that may be larger than one page? Pin
Heath Stewart28-Jun-04 3:55
protectorHeath Stewart28-Jun-04 3:55 
GeneralOne more security question Pin
MKlucher27-Jun-04 18:36
MKlucher27-Jun-04 18:36 
GeneralRe: One more security question Pin
Heath Stewart27-Jun-04 18:44
protectorHeath Stewart27-Jun-04 18:44 
GeneralRe: One more security question Pin
MKlucher27-Jun-04 19:03
MKlucher27-Jun-04 19:03 
GeneralRe: One more security question Pin
Heath Stewart27-Jun-04 19:12
protectorHeath Stewart27-Jun-04 19:12 
That's a good scenario for a "pre-check"! Smile | :)

The problem is that, as the documentation states, Demand checks callers higher in the stack. While all callers higher in the stack may have the permission, you may not. So, lets say you add this code in an event handler you've assigned to an event defined in the BCL assemblies (like handling Button.Click or something). Invoking the delegate (your handler) happens from the BCL. Those assemblies would have FullTrust permissions, but you might not.

Now, when you simply call File.Delete, you become the caller and don't have that permission, so the SecurityException is thrown.

A simple work-around is to attempt to create a dummy file (and delete it, if successful). If you can't write the file, you won't be able to delete a file (well, at least from the CLR's perspective).

 

Microsoft MVP, Visual C#
My Articles
GeneralRun Expect scripts from managed code Pin
inyoursadachine27-Jun-04 18:07
inyoursadachine27-Jun-04 18:07 
GeneralRe: Run Expect scripts from managed code Pin
Heath Stewart27-Jun-04 18:18
protectorHeath Stewart27-Jun-04 18:18 
GeneralMPEG to AVI Pin
BigBlob20227-Jun-04 10:51
BigBlob20227-Jun-04 10:51 
GeneralRe: MPEG to AVI Pin
leppie27-Jun-04 13:13
leppie27-Jun-04 13:13 
GeneralRe: MPEG to AVI Pin
BigBlob20227-Jun-04 14:23
BigBlob20227-Jun-04 14:23 
GeneralRe: MPEG to AVI Pin
Heath Stewart27-Jun-04 17:46
protectorHeath Stewart27-Jun-04 17:46 
QuestionCatching key events to a panel? Pin
misterbear27-Jun-04 7:53
misterbear27-Jun-04 7:53 
AnswerRe: Catching key events to a panel? Pin
Karl 200027-Jun-04 9:02
Karl 200027-Jun-04 9:02 
GeneralRe: Catching key events to a panel? Pin
misterbear27-Jun-04 10:54
misterbear27-Jun-04 10:54 
GeneralRe: Catching key events to a panel? Pin
Karl 200027-Jun-04 11:00
Karl 200027-Jun-04 11:00 
GeneralNeed Help Pleaaase Pin
hani_aql27-Jun-04 5:29
hani_aql27-Jun-04 5:29 
GeneralRe: Need Help Pleaaase Pin
Anonymous27-Jun-04 13:05
Anonymous27-Jun-04 13:05 
GeneralRe: Need Help Pleaaase Pin
Dave Kreskowiak27-Jun-04 14:37
mveDave Kreskowiak27-Jun-04 14:37 
Generalfirewall Pin
shahrokh nabavi27-Jun-04 2:04
shahrokh nabavi27-Jun-04 2:04 
GeneralRe: firewall Pin
leppie27-Jun-04 3:55
leppie27-Jun-04 3:55 
GeneralRe: firewall Pin
Colin Angus Mackay28-Jun-04 0:39
Colin Angus Mackay28-Jun-04 0:39 
GeneralRe: firewall Pin
JimRivera28-Jun-04 16:14
JimRivera28-Jun-04 16:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.