Asp.NET获取文件及其路径
【相对路径】
Request.ApplicationPath
/src
Path.GetDirectoryName(HttpContext.Current.Request.RawUrl )
\\src\\Xiaoshe
Context.Request.Path
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.CurrentExecutionFilePath
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.FilePath
/src/Xiaoshe/Xiaoshe_New.aspx
HttpContext.Current.Request.RawUrl
/src/Xiaoshe/Xiaoshe_New.aspx
HttpContext.Current.Request.Url
http://localhost:1344/src/Xiaoshe/Xiaoshe_New.aspx
TemplateSourceDirectory
/src/Controls
【绝对路径】
Server.MapPath("./")
E:\\Wonsoft\\Pro2\\src\\Xiaoshe\\
Server.MapPath("")
E:\\Wonsoft\\Pro2\\src\\Xiaoshe
Context.Request.PhysicalApplicationPath
E:\\Wonsoft\\Pro2\\src\\
Context.Request.PhysicalPath
E:\\Wonsoft\\Pro2\\src\\Xiaoshe\\Xiaoshe_New.aspx
MapPathSecure(TemplateSourceDirectory)
E:\\Wonsoft\\Pro2\\src\\Controls string
【其他】
Control.ResolveClientUrl(string relativeUrl)
Control.ResolveUrl(string relativeUrl)
相关文档:
在使用asp.net编写webservice时,默认情况下是不支持session的,但我们可以把WebMethod的EnableSession选项设为true来显式的打开它,请看以下例子:
1 新建网站WebSite
2 新建web服务WebService.asmx,它具有以下两个方法:
[WebMethod(EnableSession = true)]
public string Login(string name)
{
  ......
//详细介绍asp.net获取日期时间的各种格式的函数
DateTime.Now.ToLocalTime().ToString(); // 2009-9-5 20:12:12
//获取日期
DateTime.Now.ToLongDateString().ToString(); // 2009年9月5日
......
//压缩
protected void btnY_Click(object sender, EventArgs e)
{
string rar;
RegistryKey reg;
string args;
ProcessStartInfo procStart;
Process process;
try
{
reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command"); ......