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 首页性能的十大做法
前言
本文是我对ASP.NET页面载入速度提高的一些做法,这些做法分为以下部分:
1.采用 HTTP Module 控制页面的生命周期。
2.自定义Response.Filter得到输出流stream生成动态页面的静态内容(磁盘缓存)。
3.页面GZIP压缩。
4.OutputCache 编程方式输出页面缓存。
5.删除页面空白字符串 ......
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
namespace jiu ......
//根据主键来删除表中的数据。
//删除
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
OleDbConnection sqlConnection = new OleDbConnection(GetConnection());
& ......
更新方法一,直接在GridView中来更新数据.
更新方法二,打开一个新的页面来更新数据.
//更新
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
&nbs ......
一、页输出缓存
1.设置 ASP.NET
页缓存的两种方式
1.1
以声明方式设置 ASP.NET 页的缓存
以声明方式设置 ASP.NET
页的缓存的方法是在页中使用 @ OutputCache 指令,它的常用属性如下:
程序代码
<%@ OutputCache Duration="" VaryByParam=""
VaryByControl="" VaryByHeader ......