Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
QuestionHow to delete a file in locked status Pin
Exelioindia7-Apr-08 21:40
Exelioindia7-Apr-08 21:40 
AnswerRe: How to delete a file in locked status Pin
Christian Graus7-Apr-08 21:54
protectorChristian Graus7-Apr-08 21:54 
AnswerRe: How to delete a file in locked status Pin
Simon P Stevens7-Apr-08 22:35
Simon P Stevens7-Apr-08 22:35 
GeneralRe: How to delete a file in locked status Pin
Exelioindia7-Apr-08 22:49
Exelioindia7-Apr-08 22:49 
GeneralRe: How to delete a file in locked status Pin
Simon P Stevens7-Apr-08 23:00
Simon P Stevens7-Apr-08 23:00 
GeneralRe: How to delete a file in locked status Pin
Christian Graus7-Apr-08 23:04
protectorChristian Graus7-Apr-08 23:04 
AnswerRe: How to delete a file in locked status Pin
Giorgi Dalakishvili7-Apr-08 23:01
mentorGiorgi Dalakishvili7-Apr-08 23:01 
GeneralRe: How to delete a file in locked status Pin
Simon P Stevens7-Apr-08 23:11
Simon P Stevens7-Apr-08 23:11 
Understand what you are doing before you try this. This code forcefully closes the handle to the file. If another app has held the file open, it has probably done so for a reason, forcefully closing it has a strong chance of causing problems/errors in the app. If it's your app that holds the lock on the file, forcefully closing the handle will be likely leave you with invalid/null objects. You should just close the file properly.


[EDIT]
I haven't tried it, and I'm no ASP.NET expert, but I suspect you'll have problems getting this code to run anyway, because you won't have the permissions to use P/Invoke in the server environment.
[/EDIT]


Simon

GeneralRe: How to delete a file in locked status Pin
Giorgi Dalakishvili7-Apr-08 23:17
mentorGiorgi Dalakishvili7-Apr-08 23:17 
GeneralRe: How to delete a file in locked status Pin
Simon P Stevens7-Apr-08 23:25
Simon P Stevens7-Apr-08 23:25 
GeneralRe: How to delete a file in locked status [modified] Pin
Giorgi Dalakishvili7-Apr-08 23:29
mentorGiorgi Dalakishvili7-Apr-08 23:29 
QuestionRetrive item from datagridview in C# window application Pin
dev_tikili7-Apr-08 21:20
dev_tikili7-Apr-08 21:20 
GeneralRe: Retrive item from datagridview in C# window application Pin
dan!sh 7-Apr-08 22:13
professional dan!sh 7-Apr-08 22:13 
GeneralRe: Retrive item from datagridview in C# window application Pin
Sandilian7-Apr-08 22:57
Sandilian7-Apr-08 22:57 
Questionusing WinZip32 in C# Pin
nilam24777-Apr-08 20:48
nilam24777-Apr-08 20:48 
GeneralRe: using WinZip32 in C# Pin
Christian Graus7-Apr-08 21:16
protectorChristian Graus7-Apr-08 21:16 
QuestionRe: using WinZip32 in C# Pin
nilam24777-Apr-08 21:49
nilam24777-Apr-08 21:49 
GeneralRe: using WinZip32 in C# Pin
nilam24777-Apr-08 22:04
nilam24777-Apr-08 22:04 
GeneralRe: using WinZip32 in C# Pin
Christian Graus7-Apr-08 22:05
protectorChristian Graus7-Apr-08 22:05 
GeneralRe: using WinZip32 in C# Pin
Rob Philpott7-Apr-08 23:07
Rob Philpott7-Apr-08 23:07 
QuestionSTAThreadAttribute Pin
asma_panjabi7-Apr-08 20:29
asma_panjabi7-Apr-08 20:29 
GeneralRe: STAThreadAttribute Pin
Christian Graus7-Apr-08 20:32
protectorChristian Graus7-Apr-08 20:32 
GeneralRe: STAThreadAttribute Pin
asma_panjabi7-Apr-08 21:19
asma_panjabi7-Apr-08 21:19 
GeneralRe: STAThreadAttribute Pin
Christian Graus7-Apr-08 21:32
protectorChristian Graus7-Apr-08 21:32 
GeneralRe: STAThreadAttribute Pin
asma_panjabi7-Apr-08 22:56
asma_panjabi7-Apr-08 22:56 

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.