//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实现下载
pro ......
此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElement;
var objs = document.getElementsByTagName('INPUT');
for(var i=0; i< objs.length; i++)
{
if(objs[i].type.toLowerCase() == 'submit')
{
objs[i].disabled = true;
}
}
} //--> < /script>//ASP.NET中防止页面多次提交的代码:asp.netpublic class PreventMultiClick : System.Web.UI.Page {
protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.LinkButton LinkButton1; protected System.Web.UI.WebControls.Button Button3; private void Page_Load(object sender, System.EventArgs e)
{
this.GetPostBackEventReference(this.Button3);
//保证 __doPostBack(eventTarget, eventArgument) 正确注册 if ......
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
  ......
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
  ......
1.//弹出对话框.点击转向指定页面
Response.Write(" <script>window.alert('该会员没有提交申请,请重新提交!')
</script>");
Response.Write(" <script>window.location
='http://www.51aspx.com/bizpulic/upmeb.aspx' </script>");
2.//弹出对话框
Response.Write(" <script language='javascript'>alert('产品添加成功!')
</script >");
3.//删除文件
string filename ="20059595157517.jpg";
pub.util.DeleteFile(HttpContext.Current.Server.MapPath("../file/")
+filename);
4.//绑定下拉列表框datalist
System.Data.DataView dv=conn.Exec_ex("select -1 as code,'请选择经营模式'
as content from dealin union select code,content from dealin");
this.dealincode.DataSource=dv;
this.dealincode.DataTextField="content";
this.dealincode.DataValueField="code";
this.dealincode.DataBind();
this.dealincode.Items.FindByValue(dv[ ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strURl = "http://www.jxflcp.net/ssc/";//换成你要的那个网址
string str = GetHttp(strURl);
if (str != "xx")
{
//换成你想要截取网页部分内容的代码
Regex reg = new Re ......
这也许是一个小问题 但是有很多学问 不能眼高手低 我把大部分情况列出来 给大家一个提醒
float str = 987654.32F;
//Response.Write(string.Format("{0:c}", str));
//this.Label1.Text = string.Format("{0:D}", str);
//this.Label1.Text = string.Format("{0:C}", str);
Response.Write("<h1>日期格式化</h1>");
Response.Write("<br/>");
Response.Write("当前数字"+str);
Response.Write("<br/>");
Response.Write(string.Format("货币格式 {0:c}", str));
Response.Write("<br/>");
Response.Write(string.Format("科学技术法格式 {0:e}", str));
Response.Write("<br/>");
Response.Write(string.Format("科学计数法格式 12位有效数字{0:e12}", str));
Response.Write("<br/>");
Response.Write(string.Format("固定格式 {0:f}", str));
Response.Write("<br/>");
Response.Write(string.Format("固定格式 四位小数{0:f4}", str));
......