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);
Ïà¹ØÎĵµ£º
ÎÄÕ³ö´¦£ºhttp://hi.baidu.com/richiezheng/blog/item/8bb94b8692315b3867096efa.html
ÀûÓÃASP.NET¼¼Êõ¶¯Ì¬Éú³ÉHTMLÒ³Ãæ
˼·
¡¡¡¡1. ÀûÓÃÈçDw-MxÕâÑùµÄ¹¤¾ßÉú³Éhtml¸ñʽµÄÄ£°å£¬ÔÚÐèÒªÌí¼Ó¸ñʽµÄµØ·½¼ÓÈëÌØÊâ±ê¼Ç(Èç$htmlformat$),¶¯Ì¬Éú³ÉÎļþʱÀûÓôúÂë¶ÁÈ¡´ËÄ£°å£¬È»ºó»ñµÃǰ̨ÊäÈëµÄÄÚÈÝ£¬Ìí¼Óµ½´ËÄ£°åµÄ±ê¼ÇλÖÃÖ ......
¸ø³öÒ»¸ö×Ö·û´®£¬Èç¡°Öйú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 ......
1.
´Ë´¦ÌṩµÄ´úÂëÓÃÀ´ÊµÏÖµ±asp.net
Ò³ÃæÖеÄij¸öButton
±»µã»÷ºódisable
µô¸ÃÒ³ÃæÖÐËùÓеÄButton
£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton
½Å±¾.
//ASP.NET
ÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script
language="javascript"> < !-- function dis ......
Ò». ʹÓÃQueryString±äÁ¿
¡¡¡¡¡¡¡¡QueryStringÊÇÒ»Öַdz£¼òµ¥Ò²ÊÇʹÓñȽ϶àµÄÒ»ÖÖ´«Öµ·½Ê½£¬µ«ÊÇËü½«´«µÝµÄÖµÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÖÐ,Èç¹ûÊÇ´«µÝÒ»¸ö»ò¶à¸ö°²È«ÐÔÒªÇ󲻸߻òÊǽṹ¼òµ¥µÄÊýֵʱ£¬¿ÉÒÔʹÓÃÕâ¸ö·½·¨¡£
Response.Redirect( "target.aspx?param1=hello& ......
ÊÊÓÃÓÚ£ºmicrosoft ASP.NET
ÕªÒª:asp.net¶¯Ì¬Éú³ÉhtmlÒ³Ãæ,ÊÊÓÃ
¼ò½é
´Ë¹¦ÄÜÊÊÓÃÓÚºǫ́Êý¾Ý¿â¹¦Äܲ»Ç¿µÄwebÕ¾µã£¬¼´´ó²¿·ÖÎı¾²»ÊÇ´æ·ÅÔÚÊý¾Ý¿âµÄ¼Ç¼ÖУ¬¶øÊÇ·ÅÔÚhtmlÎļþ»òÕßxmlÎļþÖУ¬½ö½ö°ÑË÷Òý·Åµ½Êý¾Ý¿âÖУ¬ÈçÎÄÕ±êÌâ¡¢Àà±ð¡¢²éѯ¹Ø¼ü×ֵȡ£ÕâÑùÊʺÏÓÚºǫ́ûÓÐÖîÈçms Sql ServerÕâÑùµÄÊý¾Ý¿âÖ§³ÖµÄWebÕ¾µã¡£
ÊÊ ......