ÓÃC#(ASP.NET)ÔõôʵÏÖÎļþÏÂÔØ¹¦ÄÜ
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//TransmitFileʵÏÖÏÂÔØ
protected void Button1_Click(object sender, EventArgs e)
{
/*
΢ÈíΪResponse¶ÔÏóÌṩÁËÒ»¸öÐµķ½·¨TransmitFileÀ´½â¾öʹÓÃResponse.BinaryWrite
ÏÂÔØ³¬¹ý400mbµÄÎļþʱµ¼ÖÂAspnet_wp.exe½ø³Ì»ØÊÕ¶øÎÞ·¨³É¹¦ÏÂÔØµÄÎÊÌâ¡£
´úÂëÈçÏ£º
*/
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=z.zip");
string filename = Server.MapPath("DownLoad/z.zip");
Response.TransmitFile(filename);
}
//WriteFileʵÏÖÏÂÔØ
protected void Button2_Click(object sender, EventArgs e)
{
/*
using System.IO;
*/
string fileName ="asd.txt";//¿Í»§¶Ë±£´æµÄÎļþÃû
string filePath=Server.MapPath("DownLoad/aaa.txt");//·¾¶
FileInfo fileInfo = new FileInfo(filePath);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(fileInfo.FullName);
Response.Flush();
Response.End();
}
//WriteFile·Ö¿éÏÂÔØ
protected void Button3_Click(object sender, EventArgs e)
{
string fileName = "aaa.txt";//¿Í»§¶
Ïà¹ØÎĵµ£º
¡¡¡¡¡¡ÓÃc#¸øPDA×öÁËÒ»¸öPC¶ËµÄͨѶ³ÌÐò£¬ÐèÒª±£´æÁ½¸ö²ÎÊý¡£ÓÃDelphiʱ£¬ÊDZ£´æÔÚiniÎļþÖУ¬c#¶ÁдXML±È½Ï·½±ã£¬¾ÍÓÃxmlÎļþÀ´±£´æÁË¡£
¡¡¡¡¡¡
¡¡
class CXmlClass
{
private string XmlFilePath;
/// <summary>
/// ÏÂÔØµ½PDAµÄTXTÎļþ·¾¶¡¡
/// </summary>
......
Asp.net ºǫ́µ÷ÓÃjs·½·¨(ת)
1. ÓÃResponse.Write·½·¨
¡¡¡¡´úÂëÈçÏ£º
Response.Write("<script type='text/javascript'>alert("XXX");</script>");
´Ë·½·¨È±ÏݾÍÊDz»Äܵ÷Óýű¾ÎļþÖеÄ×Ô¶¨ÒåµÄº¯Êý£¬Ö»Äܵ÷ÓÃÄÚ²¿º¯Êý£¬¾ßÌåµ÷ÓÃ×Ô¶¨ÒåµÄº¯ÊýÖ»ÄÜÔÚResponse.WriteдÉϺ¯Êý¶¨ Ò壬±ÈÈç
Response.Write("& ......
¶Ô“Ìí¼Ó”¡¢“Ìá½»”¡¢“±£´æ”¡¢“¸üДµÈ°´Å¥ÐèÒª¶ÔÊý¾Ý¿â½øÐÐд²Ù×÷µÄ°´Å¥£¬Ò»¶¨ÒªÔÚÒ³Ãæ³õʼ»¯Ê±¼ÓÔØ½Å±¾£¬·ÀÖ¹¶à´ÎÖØ¸´µã»÷£¬ÀýÈ磺
protected void Page_Load(object sender, EventArgs e)
{
//.net 2.0ÒÔÉÏ
......
ÅäÖÃiis6½â¾öÔËÐÐasp.net mvcÏîÄ¿“ÎÞ·¨ÕÒµ½¸ÃÒ³”µÄ´íÎó
ÔÚiis6ÔËÐÐasp.net mvc ÏîĿʱ£¬Èç¹û³öÏÖ“ÎÞ·¨ÕÒµ½¸ÃÒ³”µÄÌáʾ£¬¼´404´íÎó£¬ÄÇôÓпÉÄÜÊÇiisûÓÐÉèÖú㬰´ÏÂÃæ²Ù×÷¿ÉÒÔ½â¾ö£º
´ò¿ªiis¹ÜÀíÆ÷£¬ÓÒ»÷ÏàÓ¦µÄÍøÕ¾½Úµã£¬Ñ¡Ôñ“ÊôÐÔ”¿ì½Ý²Ëµ¥£¬µ¯³öÊôÐÔ¶Ô»°¿ò£¬Ñ¡Ôñ“Ö÷Ŀ¼&rd ......
<script type="text/javascript">
var loginName,checkUN,password,confirmPwd,email,subBtn,userName,checkTel,tel;
$(init);
function init()
{
loginName = $("#loginName");
loginName.bind("blur",checkUserName);
password = $("#password"); ......