易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net自动执行任务

在复杂的业务应用程序中,有时候会要求一个或者多个任务在一定的时间或者一定的时间间隔内计划进行,比如定时备份或同步数据库,定时发送电子邮件,定期处理用户状态信息,支付系统中定期同步异常账单等等,我们称之为计划任务。实现计划任务的方法也有很多,可以采用SQLAgent执行存储过程,采用Windows任务调度程序来实现,也可以使用Windows服务来完成我们的计划任务,这些方法都是不错的解决方案。但是,以上这些都需要有服务器的权限才能进行,而对于虚拟主机客户使用的Web应用程序来说,这些方法实现起来并不是很简单的,主机服务提供商或者不能直接提供这样的服务,或者需要你支付许多额外的费用。 看过一些这方面的文章,发现有一个共同的缺点:IIS运行到一定时期,计划任务就停止了。查找原因发现是IIS的应用程序池定期回收导致计划任务停止。本文的这个方法可以解决应用程序池回收问题。
Global.asax.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Timers;
using System.Net;
using System.IO;
using System.Text;
using System.Threading;
namespace qumiao.com
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            //定义定时器 
            System.Timers.Timer myTimer = new System.Timers.Timer(5000);
            myTimer.Elapsed += new ElapsedEventHandler(myTimer_Elapsed);
            myTimer.Enabled = true;
        


相关文档:

asp.net(C#) 数据库备份还原 源码

Backup.aspx
  protected void Button1_Click(object sender, EventArgs e)
    {
        string path = Server.MapPath("") + @"\Backup";
        if (!Directory.Exists(path))
       ......

asp.net小数点四舍五入的方法

1.只要求保留N位不四舍5入
  float f = 0.55555f;int i =(int)(f * 100);f = (float)(i*1.0)/100;
  2.保留N位,四舍五入 .
  decimal d= decimal.Round(decimal.Parse("0.55555"),2);
  3.保留N位四舍五入
  Math.Round(0.55555,2)
  4,保留N位四舍五入
  double dbdata = 0.5 ......

asp.net的内置对象

ASP.NET的内置对象介绍
1.Response
2.Request
3.Server
4.Application
5.Session
6.Cookie
Request对象主要是让服务器取得客户端浏览器的一些数据,包括从HTML表单用Post或者GET方法传递的参数、Cookie和用户认证。因为Request对象是Page对象的成员之一,所以在程序中不需要做任何的声明即可直接使用;其类名为 HttpR ......

asp.net GridView的一些应用

应用1:GridView和CheckBox结合
效果图:
应用2:Extending the GridView Control
Code download available at: CuttingEdge05.exe (132 KB)
Browse the Code Online
 Contents
The GridView Difference
A New GridView Control
Adding a Checkbox Column
The New Grid In Action
Styling Selected ......

ASP.NET 2.0 AJAX中Webservice调用方法

ASP.NET 2.0 Ajax中能够在客户端js中很方便地调用服务器Webservice,以下为一些调用的示例。笔者安装的ASP.NET 2.0 AJAX
版本为AJAX November CTP。
三个示例分别为:
1 带参数的WS方法
2 不带参数的WS方法
3 参数类型为DataTable的WS方法
一、WebMethod
注意要点:
1 WebMethod类需要添加命名空间 Microsoft.Web. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号