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)
相关文档:
其实所谓的伪静态页面,就是指的URL重写.
1.首先在web.config里写
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
</configSections>
2.在web.config里添加以下节点
<httpHandlers>
< ......
//压缩
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"); ......
1、使用值类型的ToString方法
在连接字符串时,经常使用"+"号直接将数字添加到字符串中。这种方法虽然简单,也可以得到正确结果,但是由于涉及到不同的数据类型,数字需要通过装箱操作转化为引用类型才可以添加到字符串中。但是装箱操作对性能影响较大,因为在进行这类处理时,将在托管堆中分配一个新的对象,原有的值 ......
http://www.cnblogs.com/JimmyZhang/archive/2007/11/25/971878.html
引言
Http 请求处理流程 和 Http Handler 介绍 这两篇文章里,我们首先了解了Http请求在服务器端的处理流程,随后我们知道Http请求最终会由实现了IHttpHandler接口的类进行处理(应该记得Page类实现了IHttpHandler)。从 Http 请求处理流程 一文的最后的 ......
一、页输出缓存
1.设置 ASP.NET
页缓存的两种方式
1.1
以声明方式设置 ASP.NET 页的缓存
以声明方式设置 ASP.NET
页的缓存的方法是在页中使用 @ OutputCache 指令,它的常用属性如下:
程序代码
<%@ OutputCache Duration="" VaryByParam=""
VaryByControl="" VaryByHeader ......