Loading ...

How to check a website folder exists or not | CodeAsp.Net

How to check a website folder exists or not

 /5
0 (0votes)

In this blog I will explain how check a website folder exists or not.I have used Directory class Exists method to explain it.Below is the code snippet.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.IO ;

public partial class How_to_chek_a_website_folder_exists_or_not : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (Directory.Exists(Server.MapPath("~/Images/admin/")))

{

//Do your stuff

}

}

}

 

 

Above i am checking that admin folder exists inside the Images folder that is situated at the root.If it exists it will return true else false.

Happy Reading.!

 

 

Comments (no comments yet)

Top Posts