user3172321
user3172321

Reputation: 11

Server.MapPath not working in mvc

I need to fetch whether the image exist or not in folder path. I am using the below code:

bool isExists = System.IO.Directory.Exists(Server.MapPath(FolderPath + "Logo.png"));

But the bool variable returns false if the file exists.

Upvotes: 0

Views: 941

Answers (1)

IronGeek
IronGeek

Reputation: 4883

Perhaps you should use File.Exists instead.

bool isExists = System.IO.File.Exists(Server.MapPath(FolderPath + "Logo.png"));

Upvotes: 6

Related Questions