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

ASP.NET文件下载函数

在你的Page_Load中添加这样的代码:
Page.Response.Clear();
bool success = ResponseFile(Page.Request, Page.Response, "目的文件名称", @"源文件路径", 1024000);
if (!success)
      Response.Write("下载文件出错!");
Page.Response.End();
文件下载函数代码为:
public static bool ResponseFile(HttpRequest _Request,HttpResponse _Response,string _fileName,string _fullPath, long _speed)
    {
        try
        {
             FileStream myFile = new FileStream(_fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
             BinaryReader br = new BinaryReader(myFile);
            try
            {
                 _Response.AddHeader("Accept-Ranges", "bytes");
                 _Response.Buffer = false;
                long fileLength = myFile.Length;
                long startBytes = 0;
     
                double pack = 10240; //10K bytes
                //int sleep = 200;   //每秒5次    即5*10K bytes每秒
                int sleep = (int)Math.Floor(1000 * pack / _speed) + 1;
 


相关文档:

Windows 2003中配置ASP.Net环境

大家知道,Microsoft为了更好地预防恶意用户和攻击者的攻击,在默认情况下,没有将 IIS6.0 安装到 Windows Server 2003 家族的成员上。而且,当我们最初安装 IIS6.0 时,该服务在高度安全和"锁定"模式下安装。在默认情况下,IIS6.0 只为静态内容提供服务即,诸如 ASP、ASP.NET、在服务器端的包含文件、WebDAV 发布和 FrontP ......

VC6.0调用ASP.NET WebService示例

开发平台:
WinXP SP3+IIS5.1+IE7+Visual Studio 2005+Visual Studio 6.0+ MS SOAP Toolkit 3.0
 
一.创建ASP.NET WebService
Visual Studio 2005à文件à新建à网站àASP.NET Web服务项目WebServiceDemo。
以下为Service.cs代码清单:
// WebService.cs
using System;
using System ......

ASP.Net全局变量的设置和读取方法

本文介绍两种ASP.Net项目中全局变量使用的方式。web.config文件 和 Gloab文件。以下分别说明:
方法一:web.config文件
——设置:
在web.config文件里添加关键字key是通过<appSettings>标记来实现的,但是appSettings标记通常放在<system.web>.....</system.web>标记外面。例:
<conf ......

将jQuery应用于Asp.net Ajax时,应避免的3个错误

3 mistakes to avoid when using jQuery with ASP.NET AJAX
AJAX, ASP.NET, JavaScript, jQuery By Dave Ward on June 5th, 2008
Over the past few weeks, I think I have definitely embodied Jeff Atwood’s claim that we’re all amateurs, learning together. Despite my best efforts to thoroughly tes ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号