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

ASP.NET 文件下载

下载页面:
 <a href="download.ashx?url=<%=Server.UrlEncode("说明.txt")%>">下载</a>
------------------------------------------------------------------------------
download.ashx
<%@ WebHandler Language="C#" Class="download" %>
using System;
using System.Web;
public class download : IHttpHandler {
   
    public void ProcessRequest (HttpContext context) {
        string url = HttpContext.Current.Server.UrlDecode(context.Request.QueryString["url"]);
        downloadfile(url);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }
    public void downloadfile(string s_fileName)
    {
       HttpContext.Current.Response.ContentType = "application/ms-download";
       string s_path = HttpContext.Current.Server.MapPath("~/") + s_fileName;
       System.IO.FileInfo file = new System.IO.FileInfo(s_path);
       HttpContext.Current.Response.Clear();
       HttpContext.Current.Response.AddHeader("Content-Type", "application/octet-stream");
       HttpContext.Current.Response.Charset = "utf-8";
       HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(file.Name, System.Text.Encoding.UTF8));
       HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString());
       HttpContext.Current.Response.WriteFile(file.FullName);
  


相关文档:

Asp.net 文件上传(Vb.net版)

在Asp.net中实现文件的上传功能,是非常简单的一件事情,只需要利用微软提供的FileUpload控件即可轻松实现。
LargeFileUpload.aspx代码如下
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="LargeFileUpload.aspx.vb"
    Inherits="LargeFileUpload" %>
<!DOCTYPE html PUBLIC "-//W3C/ ......

asp.net生成静态页(之二)

先建个html模版页(template.htm):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 
<title>$title</title>
 
& ......

Asp.Net使用正则表达式解析中英文混排内容

给出一个字符串,如“中国China我爱你I love you”,程序可以实现中英文的区别;
识别结果如下:共四个元素
中国
China
我爱你
I love you
 
 
 string ptn = "[\u4e00-\u9fa5]+|[a-zA-Z\\s]+";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(ptn);
s ......

asp.net链接sqlserver2000、2005、access代码

Data Source=sqlservername;Initial Catalog=dbname;User ID=userid;Password=userpwd
Data Source=(local)\\SQLEXPRESS;Initial Catalog=数据库名;Integrated Security=True
Data Source=(local);Initial Catalog=数据库名;User ID=帐号;Password=帐号密码
Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\BegASPNET\ ......

用asp.net生成html静态页的两种方法~~~

第一种方法是对一个aspx页面生成html文件,先对服务器发送请求aspx页面,取服务器返回的html流,写到一个html文件里,aspx页面显示的是什么,生成的html页面就是什么
1、asp方法:
sub createHTML
  dim xmlhttp,strhtml,objAdoStream,i,myurl
  set xmlhttp=server.CreateObject("Microsoft.XMLHTTP")
&nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号