c# - Get names of all files -
on asp.net mvc project need load names of files in porject tried:
string[] files = directory.getfiles("~", @"*", searchoption.alldirectories);
but next error:
an exception of type 'system.io.directorynotfoundexception' occurred in mscorlib.dll not handled in user code additional information: not find part of path 'c:\program files (x86)\iis express\~'.
how can this?
the ~
symbol of asp.net describes path of application root directory. have to utilize server.mappath("~")
in order physical path app root.
string[] files = directory.getfiles(server.mappath("~"), @"*", searchoption.alldirectories);
c# asp.net-mvc
No comments:
Post a Comment