随笔-19  评论-6  文章-5  trackbacks-0
  2005年8月3日

找到解决的方法是:authCookie.Expires = authTkt.Expiration;

http://dotnet.org.za/thea/archive/2004/07/27/3010.aspx

I'm using Forms Authentication and Role based security for an app I'm working on. Ran into a problem that even though I set the IsPersistent parameter of the FormsAuthenticationTicket to true, next time I open the app I have to log in again...

authTkt = new FormsAuthenticationTicket(1, userId, DateTime.Now, DateTime.Now.AddYears(1), true, userRoles);

Well, doh, the plain and simple answer is that you need to set the expiry date of the cookie, otherwise it expires when the user closes the browser. Problem solved :-)

authCookie.Expires = authTkt.Expiration;

More info on ASP.Net cookies on CodeProject.

posted @ 2005-08-03 12:34 tangle 阅读(535) 评论(0) 编辑
  2005年7月13日
UrlRewriter 很好用,不过有一个问题,就是对于静态文件的引用失效,这个问题主要是因为将所有文件的的处理都从IIS转移到ASP.NET Engineer引起的,对于这个问题,Scott MitchellMapping All File Extensions to ASP.NET 一文中作了详细的论述,不过.Text的程序中要把对于静态文件的处理以及url改写相关的程序抽离出来也有一定的难度,所以暂时这个问题还不能很好的解决。

另外,从效率方面看,IIS的URL改写效率应该更高,将全部的文件处理交给ASP.NET Engineer,也许并不是一个合适的选择。
posted @ 2005-07-13 21:05 tangle 阅读(390) 评论(0) 编辑
  2005年7月1日
ScottGu 发布了ASP.NET小组对于Atlas项目的最新规划,目标是让Ajax方式的开发更便捷。

CS的下一个版本也将使用Ajax技术提升用户体验,Scott Watermasysk透露开发小组将有可能采用Ajax.NET, Prototype等开源框架。
posted @ 2005-07-01 10:56 tangle 阅读(254) 评论(0) 编辑
  2005年6月29日
Ajax并不是一种技术。它实际上是几种已经在各自领域大行其道技术的强强结合。Ajax混合了:
* 基于XHTML/CSS
* 由DOM(Document Object Model)实现动态显示与交互
* 通过XML和XSLT进行数据交换及处理
* 使用JavaScript整合上述技术

Ajax网站应用程序模型

原文参见Ajax: a New Approach to Web Applications

直观一点的说Ajax能够实现不刷新浏览器窗口(当然更不用安装额外的插件)而满足用户的操作,现在一些看上去很Cool的网站,很多是用这项技术实现的,其中包括:orkut、Gmail、Google Group、Google Suggest、Google Maps、Flickr、A9.com等。

使用Ajax的理由:

 1、通过适当的Ajax应用达到更好的用户体验;
 2、把以前的一些服务器负担的工作转嫁到客户端,利于客户端闲置的处理能力来处理,减轻服务器和带宽的负担,从而达到节约ISP的空间及带宽租用成本的目的。

更多内容 http://en.wikipedia.org/wiki/AJAX
posted @ 2005-06-29 15:24 tangle 阅读(2071) 评论(0) 编辑
  2005年2月25日

# region 方法:string TransString(stringint)按字符串的实际长度截取定长字符串
public static string TransString(string Str,int Length)
{
int i = 0, j = 0;
foreach (char Char in Str)
{
if ((int)Char > 127)
+= 2;
else
++;
if (i > Length)
{
Str 
= Str.Substring(0, j) + "";
break;
}

++;
}

return Str;
}


# endregion

按位截取字符,会有半个位留下的情况

 string GetSubString(string origStr,int endIndex){

  
byte[] bytes=System.Text.Encoding.GetEncoding("gb2312").GetBytes(origStr);

  
if(endIndex>=bytes.Length)
     
return origStr; 
  
byte[] subBytes=new byte[endIndex];
  Array.Copy(bytes,
0,subBytes,0,endIndex);
  
return System.Text.Encoding.GetEncoding("gb2312").GetString(subBytes);

 }

 


绑定xml的内容和属性
http://weblogs.asp.net/sonukapoor/archive/2004/05/10/129215.aspx

posted @ 2005-02-25 00:29 tangle 阅读(428) 评论(0) 编辑
  2005年2月2日
posted @ 2005-02-02 17:36 tangle 阅读(508) 评论(0) 编辑
  2005年1月20日
posted @ 2005-01-20 00:44 tangle 阅读(288) 评论(0) 编辑
  2005年1月1日
posted @ 2005-01-01 15:26 tangle 阅读(1586) 评论(4) 编辑
posted @ 2005-01-01 00:49 tangle 阅读(271) 评论(0) 编辑
  2004年12月31日
posted @ 2004-12-31 22:51 tangle 阅读(324) 评论(0) 编辑
仅列出标题  下一页