惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
D
Docker
GbyAI
GbyAI
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
G
Google Developers Blog
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
WordPress大学
WordPress大学
小众软件
小众软件
Engineering at Meta
Engineering at Meta
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
B
Blog
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog

博客园 - 生活需要勇气+毅力

不错的慢嗨曲 hey-ho! 火箭又崩了 都是钱闹的 离歌 忙里偷闲 古有杜甫茅屋为秋风所破歌,今有流民望房兴叹辗转反侧 今儿,不怎么高兴 又见十一 男人 - 生活需要勇气+毅力 - 博客园 换个心情 夜战 where's my love 检测是不是数字加字母的函数 山游小记 2年转瞬即过 大城小爱 滑雪归来 Anyone of us
asp.net中在当前页面组合form的内容,并提交
生活需要勇气+毅力 · 2006-07-03 · via 博客园 - 生活需要勇气+毅力

今天碰到个东东,需要把登陆信息提交到另外一个页面中,另外的那个页面是用asp做的只接收表单信息提交,没办法只好把在这边提交的信息组合成一个表单然后post过去,于是就想到了使用另外一个页面跳转提交的方法,后来发现,如果登陆失败了就没办法返回,搞的很不爽.

实在不想在另外的页面中产生form,于是想到动态生成表单然后使用数据绑定,将生成的表单绑定到当前页面,大致代码如下:

1                    Guidesubmit+="<form name='form1' action='http://www.aaa.com/login.asp' method='post'>              ";
2                    Guidesubmit+="            <input type='hidden' name='Name' size='10' maxlength='15' value='"+Name+"'>";
3                    Guidesubmit+="            <input type='hidden' name='Pass' size='10' maxlength='15' value='"+Password+"'>    ";
4                    Guidesubmit+="        </form>
    5                    Page.DataBind();

在前台使用<%# Guidesubmit%>绑定,然后在提交按扭事件里面add个js方法提交,不过总是不成功.放弃...还是用js的提交吧,改上面代码如下:

1                    Guidesubmit+="<form name='form1' action='http://www.aaa.com/login.asp' method='post'>              ";
2                    Guidesubmit+="            <input type='hidden' name='Name' size='10' maxlength='15' value='"+Name+"'>";
3                    Guidesubmit+="            <input type='hidden' name='Pass' size='10' maxlength='15' value='"+Password+"'>    ";
4                    Guidesubmit+="        </form>";
    5                    Guidesubmit+="        <script>form1.submit()</script>";
    6                    Page.DataBind();

试了一下,还是有登陆失败时用history.go(-1)不能返回的问题,不过把返回页面改成登陆页面就ok了,嘿嘿.