1.asp.net webform “Request.PhysicalApplicationPath , “\”;
2.c# winform
A:“Application.StartupPath”: , “\”;
B:“Application.ExecutablePath ”: , ;
C:“AppDomain.CurrentDomain.BaseDirectory”: , “\”;
D:“System.Threading.Thread.GetDomain().BaseDirectory”: , “\”;
E:“Environment.CurrentDirectory”: , “\”;
F:“System.IO.Directory.GetCurrentDirectory”: , “\”;
3.c# windows service “AppDomain.CurrentDomain.BaseDirectory” “System.Threading.Thread.GetDomain().BaseDirectory”;
“Environment.CurrentDirectory” “System.IO.Directory.GetCurrentDirectory” “ system32” ;
“Application.StartupPath” “Application.ExecutablePath ”, “System.Windows.Forms.dll ” , “using System.Windows.Forms” ;
4. :
System.Reflection.Assembly curPath = System.Reflection.Assembly.GetExecutingAssembly();
string path=curPath.Location;// SetupLibrary , ;
System.Diagnostics.StackFrame f = new System.Diagnostics.StackFrame(1);
MethodBase mb = f.GetMethod();
System.Web.HttpContext.Current.Response.Write(mb.DeclaringType.ToString()); ,