社区
ASP
帖子详情
asp用Request.Form("ID")接收"ID"后,有什么办法使.Form("id")内容清空,使“刷新"不再执行。
ly2099
2000-03-19 02:47:00
...全文
120
1
打赏
收藏
asp用Request.Form("ID")接收"ID"后,有什么办法使.Form("id")内容清空,使“刷新"不再执行。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
zwboy
2000-03-19
打赏
举报
回复
设置 Response.Expires = 0 以及在Session中设置一个接收"ID"Flag。
然后判断Flag
asp
生成图片验证码类
使用示例,请自行修改代码以适应你的页面: 提交页from.
asp
<% '如果验证码为空或者验证码不正确,
执行
Then
内容
,否则
执行
else
内容
If IsEmpty(Session("GetCode")) Or Session("GetCode") <> UCase(
Request
.
form
("
Form
_Code")) Then Response.Write "<script>alert('验证码输入错误!');history.go(-1)清空Session End If %> 调用页main.
asp
,点击图片更换验证码 <
form
method="post" action="from.
asp
">
<script language=javascript>document.write("
asp align=absm
id
dle
id
=Image1 onclick=Image1.src='code.
asp
?'+Math.random(); alt=看不清楚/>");
经典cookie购物车源码[Gr
id
View实现]
特别说明请注意: 根许多网友反应, using Maticsoft.Functions; 这些代码看不懂 其实Functions 这个dll是我定义常用的函数类,如果需要跟我联系索取http://sql8.net 下面有我的群号, 其中 ArtsShop.Model.Arts_Product _p = new ArtsShop.Model.Arts_Product(); ArtsShop.BLL.Arts_Product p = new ArtsShop.BLL.Arts_Product(); _p = p.GetModel(
id
); 这是我的商品信息的类,三层结构,这个在用时你们只能换成你们自己的,这些代码完全可以删除, 比如 MyDr[1] = _p.Title; 用来读取商品名的,你们可以改MyDr[1] = dr["productname"].ToString();就行了, AddToCart.
asp
x页面代码 无标题页 <
asp
:TextBox
ID
="TextBox1" runat="server" Text='' W
id
th="44px"> <
asp
:Label
ID
="Label1" runat="server" Text=''> 保存 取消 编辑 继续购物
清空
购物车 下订单 AddToCart.
asp
x.cs页面代码 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 Maticsoft.Functions;public partial class AddToCart : System.Web.UI.Page { protected vo
id
Page_Load(object sender, EventArgs e) { int Pro
ID
; HttpCookie cookie; bool Tempbl = false; string Tempstr; if (!Page.IsPostBack) { if (!object.Equals(
Request
.QueryString["
id
"], null)) { Pro
ID
= int.Parse(
Request
.QueryString["
id
"]); //创购物车cookie yxy .//sql8.net if (object.Equals(
Request
.Cookies["ztbscart"], null)) cookie = new HttpCookie("ztbscart"); else cookie =
Request
.Cookies["ztbscart"]; //判断是否已存在于购物车内 yxy // sql8.net for (int i = 0; i < cookie.Values.Keys.Count; i++) { if (!object.Equals(cookie.Values.Keys[i], null)) { Tempstr = cookie.Values.AllKeys[i].ToString(); if (Tempstr.Trim() != "") { if (Pro
ID
== int.Parse(cookie.Values.AllKeys[i])) { Tempbl = true; break; } } } } //不未购买过则加入购物车 yxy //sql8.net if (!Tempbl) cookie.Values.Add(Pro
ID
.ToString(), "1"); else { } TimeSpan ts = new TimeSpan(0, 0, 10, 0); cookie.Expires = DateTime.Now + ts; Response.AppendCookie(cookie); } BindGr
id
(); } } //绑定数据 yxy //sql8.net private vo
id
BindGr
id
() { DataTable MyDt; DataRow MyDr; string str = ""; MyDt = new DataTable(); MyDt.Columns.Add(new DataColumn("
id
", str.GetType())); MyDt.Columns.Add(new DataColumn("Title", str.GetType())); MyDt.Columns.Add(new DataColumn("Num", str.GetType())); MyDt.Columns.Add(new DataColumn("Price", str.GetType())); MyDt.Columns.Add(new DataColumn("Discount", str.GetType())); MyDt.Columns.Add(new DataColumn("Vipprice", str.GetType())); MyDt.Columns.Add(new DataColumn("Totle", str.GetType())); if (!object.Equals(
Request
.Cookies["ztbscart"], null)) { HttpCookie cookie =
Request
.Cookies["ztbscart"]; double Totle; //Response.Write("|" +
Request
.Cookies["ztbscart"].Values.Keys[1].ToString() + "|"); //Response.End(); for (int i = 0; i < cookie.Values.Keys.Count; i++) { int
id
; MyDr = MyDt.NewRow(); if (cookie.Values.AllKeys[i] != "" && cookie.Values[i] != "") {
id
= int.Parse(cookie.Values.AllKeys[i].ToString()); ArtsShop.Model.Arts_Product _p = new ArtsShop.Model.Arts_Product(); ArtsShop.BLL.Arts_Product p = new ArtsShop.BLL.Arts_Product(); _p = p.GetModel(
id
); MyDr[0] =
id
; MyDr[1] = _p.Title; MyDr[2] = cookie.Values[i]; MyDr[3] = _p.Price; MyDr[4] = _p.Discount; MyDr[5] = _p.Vipprice1; Totle = double.Parse(MyDr[2].ToString()) * double.Parse(MyDr[5].ToString()); MyDr[6] = Totle; MyDt.Rows.Add(MyDr); } } Gr
id
View1.DataSource = MyDt.DefaultView; Gr
id
View1.DataBind(); } } protected vo
id
Gr
id
View1_RowEditing(object sender, Gr
id
ViewEditEventArgs e) { //编辑某行数量 yxy //sql8.net Gr
id
View1.EditIndex = e.NewEditIndex; BindGr
id
(); } protected vo
id
Gr
id
View1_RowCancelingEdit(object sender, Gr
id
ViewCancelEditEventArgs e) { //取消更新 yxy //sql8.net Gr
id
View1.EditIndex = -1; BindGr
id
(); } protected vo
id
Gr
id
View1_RowUpdating(object sender, Gr
id
ViewUpdateEventArgs e) { //更新数量 yxy //sql8.net string num; TextBox tempbx = new TextBox(); Label templb = new Label(); tempbx = (TextBox)(Gr
id
View1.Rows[e.RowIndex].Cells[6]).Controls[1]; num = tempbx.Text.ToString(); HttpCookie cookie = new HttpCookie("ztbscart"); for (int i = 0; i < Gr
id
View1.Rows.Count; i++) { string
id
; string tempnum;
id
= Gr
id
View1.Rows[i].Cells[1].Text.ToString(); if (e.RowIndex == i) tempnum = num; else { templb = (Label)(Gr
id
View1.Rows[i].Cells[6]).Controls[1]; tempnum = templb.Text.ToString(); } if (tempnum.Trim() == "") tempnum = "0"; //Response.Write("
ID
:"+
id
.ToString() + "Num:"+tempnum+":"+i+"");//测试用途 yxy//sql8.net cookie.Values.Add(
id
, tempnum); } //Response.End(); TimeSpan ts = new TimeSpan(0, 0, 10, 0); cookie.Expires = DateTime.Now + ts; Response.AppendCookie(cookie); Gr
id
View1.EditIndex = -1; Message.GoTo("AddToCart.
asp
x"); } protected vo
id
LinkButton4_Click(object sender, EventArgs e) { //继续购物 yxy //sql8.net Message.WebClose(); } protected vo
id
LinkButton3_Click(object sender, EventArgs e) { //
清空
购物车 yxy //sql8.net CheckBox tempcb = new CheckBox(); HttpCookie cookie = new HttpCookie("ztbscart"); Label templb = new Label(); for (int i = 0; i < Gr
id
View1.Rows.Count; i++) { tempcb = (CheckBox)(Gr
id
View1.Rows[i].Cells[0]).Controls[1]; if (!tempcb.Checked) { string
id
; string tempnum;
id
= Gr
id
View1.Rows[i].Cells[1].Text.ToString(); templb = (Label)(Gr
id
View1.Rows[i].Cells[6]).Controls[1]; tempnum = templb.Text.ToString(); if (tempnum.Trim() == "") tempnum = "0"; //Response.Write("
ID
:"+
id
.ToString() + "Num:"+tempnum+":"+i+"");//测试用途 yxy//sql8.net cookie.Values.Add(
id
, tempnum); } } TimeSpan ts = new TimeSpan(0, 0, 10, 0); cookie.Expires = DateTime.Now + ts; Response.AppendCookie(cookie); Message.GoTo("AddToCart.
asp
x"); } protected vo
id
CheckAll_CheckedChanged(object sender, EventArgs e) { //全选事件 yxy //sql8.net CheckBox tempcb = new CheckBox(); bool tempbl; tempcb = (CheckBox)(Gr
id
View1.HeaderRow.Cells[0]).Controls[1]; tempbl = tempcb.Checked; for (int i = 0; i < Gr
id
View1.Rows.Count; i++) { tempcb = (CheckBox)(Gr
id
View1.Rows[i].Cells[0]).Controls[1]; tempcb.Checked = tempbl; } } } _________________________________________________________________________ 如转载请注明原出处 www.sql8.net
如何将一个TXT文档里
内容
导入到文本框里
第一个文件ajax_txt.
asp
的代码: (此页是AJAX异步提交txt文本文件的路径到ajax_txt_save.
asp
页面,并从ajax_txt_save.
asp
获取返回的数据)
无标题文档
<script type="text/javascript">
JS读取文本文件的
内容
并赋值给textarea控件
<
form
id
="
form
1" name="
form
1" action="index.
asp
?Action=Write" method="post">
id="FileName" name="FileName" size="30">
id="textarea1" name="textarea1" cols="46" rows="20">
已导入:
id="num">0
条记录
form
>
第二个文件ajax_txt_save.
asp
的代码: (此页是用
ASP
中的FSO来读取txt文本文件中的
内容
并输出,为ajax_txt.
asp
这个页面的AJAX异步获取提供数据) <% '//禁止缓存该页 让AJAX读取该页始终为最新而非过期缓存页 Response.Expires = 0 Response.Expiresabsolute = Now() - 1 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "no-cache" response.Charset="GB2312" '//数据返回的编码类型 显示中文数据必须 Dim objFSO Dim objText Dim ObjFile Dim strTextContent Dim objDrive '创建一个文件操作对象实例 Set objFSO = CreateObject("Scripting.FileSystemObject") '要打开的文件 ObjFile=trim(
request
("filesname")) '从文浏览控件中获取 IF objFSO.FileExists(ObjFile) then Set objText = objFSO.OpenTextFile(ObjFile,1) '循环读取数据 k=0 While not objText.AtEndOfStream '到文件的末尾 strTextContent = strTextContent & objText.ReadLine() & vbcrlf k=k+1 wend objText.Close response.write strTextContent & "," & k else strTextContent= "文件不存在" response.end() end if %> 以上代码经测试,100%能使用,且不受浏览器的安全级别限制,祝你好运!
asp
下对POST提交数据限制的解决方法
问题的解决
办法
是,对于一个需要发送大数据的域,在提交表单前将数据拆分为小于限额的数份,分别放在数个h
id
den域中,同时把原有域
清空
,再正式提交表单。服务器端还是用
Request
.
Form
()读取各h
id
den域的数据,再按照顺序把他们拼接起来就行了。主要代码如下: 注意:需要在
Form
中的HTML代码内指定一个DIV,以便向其中动态插入h
id
den域。 ====客户端示例代码==== 在
Form
中的HTML代码内加入:
id=divH
id
den>
,在
Form
标签中加入: onSubmit=”return fnPreHandle(this)”,将下面代码中的BigField
ASP
.NET
Request
.Params用法
【转载】http://blog.csdn.net/works07/article/details/5823050 使用
Request
.Params["
id
"]来获取参数是一种比较有效的途径。 有三种方式可以进行参数传递:(1).
Form
(2). ?
id
= (3).cookie
request
.params其实是一个集合,它依次包括
request
.querystring、reque
ASP
28,391
社区成员
357,059
社区内容
发帖
与我相关
我的任务
ASP
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
复制链接
扫一扫
分享
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章