WINFOM get the application's current path
System.diagnostics.process.getcurrentprocess (). Mainmodule.filename;
Gets the full path of the main module that is associated with the currently active process, including the filename (process name), for the new process component.
Return e:c# Learn get current path get current path Bindebug get current path. exe system.appdomain.currentdomain.setupinformation.applicationbase;
Gets and sets the name of the directory that contains the application.
Return e:c# Learn get current path get current path bindebug
System.windows.forms.application.startuppath;
Gets the path of the executable file that started the application, excluding the name of the executable file.
Return e:c# Learn get current path get current path bindebug
System.windows.forms.application.executablepath;
Gets the path to the executable that started the application, including the name of the executable file.
Return e:c# Learn get current path get current path Bindebug get current path. exe system.io.directory.getcurrentdirectory ();
Gets the current working directory of the application (unreliable).
Return e:c# Learn get current path get current path bindebug
This.gettype (). assembly.location;
Gets the full path of the current process, including the filename (process name).
Sorry static method is not available
Return e:c# Learn get current path get current path Bindebug get current path. exe
String path = ""; if (system.environment.currentdirectory = = appdomain.currentdomain.basedirectory)//windows application is equal to {path = Appdomain.currentdomain.basedirectory; else {path = appdomain.currentdomain.basedirectory + ' bin '; }
C # webform File access
String[] Getdirectoryfiles (string dirvpath, String pattern)
{
String dirvpathrooted = String.Concat (
Httpcontext.current.request.applicationpath.tolower (),
Dirvpath);
String dirpath = Httpcontext.current.server.mappath (dirvpathrooted);
string[] files = directory.getfiles (Dirpath, pattern, searchoption.alldirectories);
String[] includes = new String[files.length];
for (int i = 0; i < files.length; i++)
{
Includes[i] = Files[i]
. replace (Dirpath, Dirvpath)//Replace physical root by virtual root
. replace (', '/');
}
return includes;
}