由于项目的需要不允许系统在提交之后,按ie的后退按钮进行再次提交。
试试了一下在 .NET中通过如下语句
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
就可以使页面的缓存失效,每次都需要获取新页面
在 Windows 平台上,GUID 广泛应用于微软的产品中,用于标识如如注册表项、类及接口标识、数据库、系统目录等对象。
缓存是位于CPU与内存之间的临时存储器。容量比内存小但交换速度快。工作原理是当CPU要读取一个数据时,首先从缓存中查找,如果找到就立即读取并送给CPU处理,如果没有找到,就用相对慢的速度从内存中读取并送给CPU处理,同时把这个数据所在的数据块调入缓存,可以使得以后对整块数据的读取都从缓存中进行,不必再调用。
获取缓存很经典的式子:
第一步:获取缓存
IList<PriceCement> ListCement=Function.GetCacheObject(ckeyforIndex) as List<PriceCement>
为空的话:从数据库获取
if(ListCement==null ||ListCement.Count<=0)
{
lock(lockHelper)
{
第二步:锁定并再次获取缓存
ListCement=Function.GetCacheObject(ckeyforIndex) as List<PriceCement>;
if(ListCement==null||ListCement.Count<=0)
{
SerPriceCementSoapClient pricement=new SerPriceCementSoapClient();
ListCement=new List<PriceCement>();
string plist=""; foreach(var pcode in pcodearray){if(pcode!=null){plist+=pcode+","}}
第三步:如果获取不到的话从方法中读取
plist=plist.TrimEnd(','); LIstCement=pricement.SearchAllByUpDown(10, null, plist, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1);
第四步:添加缓存:
Function.AddCacheObject(ckeyforErea,ListCement,DateTime.Now.AddSeconds(ctime));
}
}
return ListCement;
}
string.Format
|
地址:http://localhost:1897/News/Press/Content.aspx /123?id=1#toc |
Request.ApplicationPath | / |
Request.PhysicalPath(请求的物理文件名称) | D:\Projects\Solution\web\News\Press\Content.aspx |
Request.PhysicalApplicationPath | D:\Projects\Solution\web\ |
Request.CurrentExecutionFilePath | /News/Press/Content.aspx |
Request.FilePath | /News/Press/Content.aspx |
Request.Path | /News/Press/Content.aspx/123 |
Request.RawUrl | /News/Press/Content.aspx/123?id=1 |
Request.Url.AbsolutePath | /News/Press/Content.aspx/123 |
Request.Url.AbsoluteUri | http://localhost:1897/News/Press/Content.aspx/123?id=1 |
Request.Url.Scheme | http |
Request.Url.Host | localhost |
Request.Url.Port | 1897 |
Request.Url.Authority | localhost:1897 |
Request.Url.LocalPath | /News/Press/Content.aspx/123 |
Request.PathInfo | /123 |
Request.Url.PathAndQuery | /News/Press/Content.aspx/123?id=1 |
Request.Url.Query | ?id=1 |
Request.Url.Segments | / News/ Press/ Content.aspx/ 123 |
1.NameValueCollection类集合是基于 NameObjectCollectionBase 类。
但与 NameObjectCollectionBase 不同,该类在一个键下存储多个字符串值(就是键相同,值就连接起来如下例子)。该类可用于标头、查询字符串和窗体数据。
每个元素都是一个键/值对。NameValueCollection 的容量是 NameValueCollection 可以保存的元素数。
NameValueCollection 的默认初始容量为零。随着向 NameValueCollection 中添加元素,容量通过重新分配按需自动增加。
如下例子:
NameValueCollection myCol = new NameValueCollection();
myCol.Add("red", "rojo");//如果键值red相同结果合并 rojo,rouge
myCol.Add("green", "verde");
myCol.Add("blue", "azul");
myCol.Add("red", "rouge");
2.NameValueCollection与Hashtable的区别
a.引用区别
hashtable:using System.Collections;
NameValueCollection:using System.Collections.Specialized;
b.键是否重复
NameValueCollection:允许重复.
HashTable是键-值集合,但键不能出现重复.
Hashtable ht = new Hashtable();
ht.Add("key","value");
ht.Add("key", "value1"); //出错
ht["key"] = "value1"; //正确
在属性中的使用:
public static NameValueCollection KindNV
{
get{
NameValueCollection nvKind=new NameValueCollection
foreach(Kind item in KindList){nvKind.Add(item.Id.ToString(),item.Name)}
return nvKind;
}
}
base.CheckPower(power); 中的base:调用基类的方法。
在设置大类时常用的枚举如下所示:
/// <summary>
/// 水泥类型(大类)
/// </summary>
public enum CateoryEnums : long
{
/// <summary>
/// 水泥
/// </summary>
Cement = 101,
/// <summary>
/// 普通水泥
/// </summary>
NormalCement = 101001,
/// <summary>
///特种水泥
/// </summary>
SpecialCement = 101002,
/// <summary>
///熟料
/// </summary>
MaterialCement = 101003,
/// <summary>
/// 煤炭
/// </summary>
Coal = 102
}
可以尝试的:关于分页控件的写法。
相关类库的整理。