Click here to Skip to main content
15,886,857 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionDelete files from server folders Pin
Sean_Vt25-Feb-15 8:36
Sean_Vt25-Feb-15 8:36 
AnswerRe: Delete files from server folders Pin
Afzaal Ahmad Zeeshan25-Feb-15 21:45
professionalAfzaal Ahmad Zeeshan25-Feb-15 21:45 
GeneralRe: Delete files from server folders Pin
Sean_Vt25-Feb-15 23:21
Sean_Vt25-Feb-15 23:21 
AnswerRe: Delete files from server folders Pin
Afzaal Ahmad Zeeshan25-Feb-15 23:41
professionalAfzaal Ahmad Zeeshan25-Feb-15 23:41 
GeneralRe: Delete files from server folders Pin
Sean_Vt25-Feb-15 23:58
Sean_Vt25-Feb-15 23:58 
AnswerRe: Delete files from server folders Pin
Afzaal Ahmad Zeeshan26-Feb-15 0:02
professionalAfzaal Ahmad Zeeshan26-Feb-15 0:02 
GeneralRe: Delete files from server folders Pin
Sean_Vt26-Feb-15 0:05
Sean_Vt26-Feb-15 0:05 
AnswerRe: Delete files from server folders Pin
Afzaal Ahmad Zeeshan26-Feb-15 0:14
professionalAfzaal Ahmad Zeeshan26-Feb-15 0:14 
First, sorry for being rude.

Secondly, you should try this code then.

C#
File.Delete(Server.MapPath("~/Files/Location.format"));


You can pass the virtual location to your file and it would delete the real file from the machine. The Server.MapPath[^] should be used when working on a web application, on an HTTP server you don't specifically share the actual path to a resource, instead you share the virtual path to the file using a URL and a domain and so on, in such scenarios Server.MapPath() is used to handle the virtual paths and converts it to real path; such as D:\Files\Location.format. You can read the MSDN document I have attached to the answer too. Smile | :)
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~

GeneralRe: Delete files from server folders Pin
Sean_Vt26-Feb-15 6:09
Sean_Vt26-Feb-15 6:09 
QuestionAccess from data from Ms access Pin
Praveen Kandari24-Feb-15 20:31
Praveen Kandari24-Feb-15 20:31 
QuestionRe: Access from data from Ms access Pin
Richard MacCutchan25-Feb-15 4:28
mveRichard MacCutchan25-Feb-15 4:28 
AnswerRe: Access from data from Ms access Pin
Praveen Kandari25-Feb-15 17:52
Praveen Kandari25-Feb-15 17:52 
GeneralRe: Access from data from Ms access Pin
Richard MacCutchan25-Feb-15 21:32
mveRichard MacCutchan25-Feb-15 21:32 
GeneralRe: Access from data from Ms access Pin
Praveen Kandari25-Feb-15 22:41
Praveen Kandari25-Feb-15 22:41 
GeneralRe: Access from data from Ms access Pin
Richard MacCutchan25-Feb-15 22:48
mveRichard MacCutchan25-Feb-15 22:48 
QuestionASP.Net button appears twice in run time Pin
sudevsu24-Feb-15 8:52
sudevsu24-Feb-15 8:52 
QuestionRe: ASP.Net button appears twice in run time Pin
jkirkerx24-Feb-15 10:31
professionaljkirkerx24-Feb-15 10:31 
AnswerRe: ASP.Net button appears twice in run time Pin
sudevsu27-Feb-15 3:23
sudevsu27-Feb-15 3:23 
AnswerRe: ASP.Net button appears twice in run time Pin
loben324-Feb-15 22:30
loben324-Feb-15 22:30 
GeneralRe: ASP.Net button appears twice in run time Pin
sudevsu27-Feb-15 3:23
sudevsu27-Feb-15 3:23 
QuestionRegarding asp.net cookie less form authentication Pin
Tridip Bhattacharjee23-Feb-15 21:02
professionalTridip Bhattacharjee23-Feb-15 21:02 
AnswerRe: Regarding asp.net cookie less form authentication Pin
ZurdoDev24-Feb-15 5:00
professionalZurdoDev24-Feb-15 5:00 
AnswerMessage Closed Pin
24-Feb-15 18:35
Celin Smith24-Feb-15 18:35 
GeneralRe: Regarding asp.net cookie less form authentication Pin
Tridip Bhattacharjee24-Feb-15 20:27
professionalTridip Bhattacharjee24-Feb-15 20:27 
AnswerRe: Regarding asp.net cookie less form authentication Pin
F-ES Sitecore24-Feb-15 23:50
professionalF-ES Sitecore24-Feb-15 23:50 

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.