asp.net定时执行代码
string LogPath;
Thread thread;
void WriteLog()
{
while (true)
{
StreamWriter sw = new StreamWriter(LogPath, true, Encoding.UTF8);
sw.WriteLine(thread.Name + ":" + DateTime.Now.ToString());
sw.Close();
Thread.CurrentThread.Join(1000 * 60);//阻止1分钟
}
}
void Application_Start(object sender, EventArgs e)
{
LogPath = HttpContext.Current.Server.MapPath("log.txt");
//在应用程序启动时运行的代码
thread = new Thread(new ThreadStart(WriteLog));
thread.Name = "写登录日志线程";
thread.Start();
}
相关文档:
之前也是在网上找的dotMsn可以获取了,之后又在网上看到说是msn升级了dotMsn获取不到了,怎么办那,我现在在做一个社区网,里面有邀请好友加入的功能,需要获取到msn的联系人,如果有哪位高手知道的,麻烦给我发一份,先谢谢了!msn:gongchuanbo@live.cn ,qq:476759761 ......
打开一个网页,上面显示5秒钟以后跳转到其他网页,每过一秒,它就会改变(4秒钟以后跳转,3秒钟以后跳转。。。)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head&g ......
看过微软的网站有时候,是.MSPX的扩展名?其实你也可以配置,很简单。Here We Go!
配置WEB.CONFIG:
<system.web>
<compilation>
<buildProviders>
<add ......
分页是最常用的功能之一,这段分页代码适合初学者。
以新闻分页为例,代码共包含三个部分:一是分页页码显示,二是显示当前页的新闻,三是后台代码。
一、页码显示
1.在后台定义一个变量:protected string PageInfo = "";
2.执行分页,赋值后在前台输出:<%=PageInfo%>
二、显示当前页的新闻
使用 ......
protected void Page_Load(object sender, EventArgs e)
...{
this.btnOK.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(btnOK, "Click") + ";this.disabled=true; this.value='提交中...';");
}
//按钮处理方法
protected void btnOK_C ......