Delete web page from root directory on button click using C# in ASP.Net

nauna
 
on Jun 11, 2016 11:02 AM
3321 Views

hi,

 

i want to delete page from project, on button click event.

 

like i have default.aspx page on project then i have mypage.aspx page in my project. on mypage.aspx i have button i want when i click button so it delete/remove default.aspx page from my project.

 

please advice

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Andrea
 
on Jun 11, 2016 11:02 AM
Hi @nauna,
Please try the following

How to open a page in a new tab using ImageButton OnClick Event ASP.Net

It might help you.

Cheers Andrea.
nauna
 
on Jun 11, 2016 11:29 AM

irrelevant reply from @andrea

nauna
 
on Jun 11, 2016 02:23 PM

C#

try
{
    string Filename3 = "~/Default1.master";
    File.Delete(Server.MapPath(Filename));
    File.Delete(Server.MapPath(Filename3));
    Response.Write("Updated Successfully");
}
catch (Exception)
{
    throw;
}