Gabriel Mendez
Gabriel Mendez

Reputation: 1115

How to get the physical path of a IIS virtual directory on ASP.NET

I have a virtual directory on IIS7 that is pointing to a folder inside my application root. I have some files there and I need my asp.net application reads and lists those files. How can I do that? Is there any way to know which is the real physical path of a virtual directory from asp.net? I'd really appreciate any help. Thanks.

Upvotes: 3

Views: 4626

Answers (1)

amit_g
amit_g

Reputation: 31270

You can use Server.MapPath

string physicalFilePath = Server.MapPath("~/path/relative/to/my/app");

Upvotes: 2

Related Questions