易截截图软件、单文件、免安装、纯绿色、仅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/ ......

C# Asp.NET 生成GOOGLE地图和索引

(1)首先要对内容的特殊字符进行过虑:
C# 代码:
public string res(string partno)
{
partno = partno.Replace("&", "");
partno = partno.Replace("/", "");
partno = partno.Replace("&", "");
return partno;
}
(2)从数据库中获得要生成地图的内 ......

ASP.NET的HTMLTable原样导出到Excel

 
文章出处:http://www.cnblogs.com/tomcat112906/articles/922639.html
 
ASP.NET的HTMLTable原样导出到Excel
js代码 : function PrintTableToExcelEx(objTab)
            {
        &nbs ......

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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号