读书人

asp 资料 网页生成了 过多的重定向

发布时间: 2013-07-27 22:21:00 作者: rapoo

asp 文件 网页生成了 过多的重定向
file1:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>红头文件提交</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>

<body>
<form action="file2.asp" method="post" enctype="multipart/form-data" name="form1" id="form1">
<p>全文标题:
<textarea name="title" id="title"></textarea>
*<span class="STYLE1">注:如要换行请在后面加<br></span></p>
<p>      </p>
<p>发文字号:
<input name="ad" type="text" id="ad" />
<label>
<input name="date" type="text" id="date" />
</label>
<input name="date2" type="text" id="date2" />
号*</p>
<p>文章标题:

<textarea name="title2" id="title2"></textarea>
*</p>
<p>          </p>
<p>主送机关:
<input name="name1" type="text" id="name1" />
*</p>
<p>正文:
<textarea name="file" wrap="physical" id="file"></textarea>
*</p>
<p>附件:
<label></label>
<input name="file1" type="file" id="file1" />
* </p>
<p>    
<input name="file2" type="file" id="file2" />
</p>
<p>    
<input name="file3" type="file" id="file3" />
   

<p> </p>
<p>日期:
<input name="year" type="text" id="year" />



<input name="month" type="text" id="month" />

<input name="day" type="text" id="day" />
日 * </p>
<p>
<input type="submit" name="Submit" value="提交" />
<input type="reset" name="Submit2" value="取消" />
</p>
<p> </p>


</form>


</body>
</html>


file2:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>红头文件</title>

<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:29px;
top:56px;
width:1061px;
height:3px;
z-index:1;
background-color: #FF0000;
}
#Layer2 {
position:absolute;
left:46px;
top:55px;
width:1044px;
height:2px;
z-index:1;
background-color: #FF0000;
}
.STYLE1 {font-family: "仿宋"}
.STYLE2 {
color: #000000;font-weight:bold;font-size:18pt;line-height: 150%;
}
.STYLE3{
color: #ff0000;font-weight:bold;font-size: 36pt;line-height:150%;
}
.STYLE4 {
color: #000000;font-size:18pt;line-height:normal
}
-->
</style>
</head>

<body>
<!--#include file="upload.asp"-->
<%
str1 = request.form("title")
str2 = request.form("ad")
str3 = request.form("date")
str4 = request.form("date2")
str5 = request.form("title2")
str6 = request.form("name1")
str7 = request.form("file")
str8 = request.form("file1")
str9 = request.form("file2")
str10 = request.form("file3")


str11 = request.form("year")
str12 = request.form("month")
str13 = request.form("day")



Session("s1") = str1
Session("s2") = str2
Session("s3") = str3
Session("s4") = str4
Session("s5") = str5
Session("s6") = str6
Session("s7") = str7
Session("s8") = str8
Session("s9") = str9
Session("s10") = str10
Session("s11") = str11
Session("s12") = str12
Session("s13") = str13
session("s14") = filename1


%>

<div align="center">
<p>
<span class="STYLE3">
<%
with response
.Write session("s1")&"<br>"

end with
%>
</span>
<span class="STYLE4">
<%

with response
.Write session("s2")
.Write "〔"
.Write session("s3")
.Write "〕"
.Write session("s4")
.write "号"&"<br>"
end with
%>
</span>
</p>
<p><img src="file_2.GIF" width="1034" height="3" /> </p>
</div>

<div align="center">
<span class="STYLE2">
<%

with response
.Write session("s5")&"<br>"

end with
%>
</span>

</div >
<br>
<div align="left">
<span class="STYLE4">


<%
with response
.Write session("s6")
.Write ":"
.Write "<br>"
end with
%>
    
<%
response.Write session("s7")


%>
<br>

      附件:1.
<a href= download3.asp?FileName=<%= Session("s14") %>>
<% response.write filename1 %>
</a>


<br>
            2.
<% response.write session("s9" )%>
<br>
            3.
<% response.write session("s10" )%>
<br>
</span>
</div>

<div align="right" class="STYLE1">
<span class="STYLE4">
<% response.Write session("s11")%>年
<% response.Write session("s12")%>月
<% response.Write session("s13")%>日    
</span>
</div>
<form id="form1" name="form1" method="post" action="file1.asp">
<label>
<input type="submit" name="Submit" value="返回" />
</label>
</form>
</body>
</html>


upload 文件:
 <!--#include file="UpLoad_Class.asp"-->  


<%
dim upload
set upload = new AnUpLoad
upload.Exe = "*"
upload.MaxSize = 10 * 1024 * 1024 '2M
upload.GetData()
if upload.ErrorID>0 then
response.Write upload.Description
else
dim file,savpath,filename1,filepath1,filename2,filepath2,filename3,filepath3
savepath = "upload"
set file = upload.files("file1")
if file.isfile then
result = file.saveToFile(savepath,1,true)
if result then
response.Write "上传成功"
filename1 = file.LocalName '赋值给filename1
filepath1 = server.MapPath(savepath & "/" & file.filename)
end if
end if

set file = upload.files("file2")
if file.isfile then
result = file.saveToFile(savepath,1,true)
if result then
filename2= file.LocalName
filepath2= server.MapPath(savepath & "/" & file.filename)
end if
end if

set file = upload.files("file3")
if file.isfile then
file.UserSetName = "jo-test"
result = file.saveToFile(savepath,1,true)
if result then
filename3 = file.LocalName
filepath3= server.MapPath(savepath & "/" & file.filename)

end if
end if

set file = nothing
end if
set upload = nothing
response.Redirect "file2.asp"
%>



信息填在file1,提交表单,就出现重定向,不知道怎么改了??
我想点击一,就进入file2,在这个过程中,上传的文件也得上传,可不行,求大神帮帮忙 ASP session 上传
[解决办法]
1#不是说了,response.Redirect "file2.asp"这句重复定向了。去掉upload 文件中的这句代码
[解决办法]
并没有将session 里面的值传过来,所以....
re:
upload有没有被file2引用跟session有关系吗?你先把response.Redirect "file2.asp"从upload中拿掉你再试试,都不明白你要干么
------解决方案--------------------


你去掉那就就会继续执行file2中
<!--#include file="upload.asp"-->
这个包含语句下面的代码了,有什么问题?你最后不是有一个按钮返回file1的
[解决办法]
file2中用session保存其他信息的代码发到upload中

<!--#include file="UpLoad_Class.asp"-->

<%
dim upload
set upload = new AnUpLoad
upload.Exe = "*"
upload.MaxSize = 10 * 1024 * 1024 '2M
upload.GetData()
if upload.ErrorID>0 then
response.Write upload.Description
else
dim file,savpath,filename1,filepath1,filename2,filepath2,filename3,filepath3
savepath = "upload"
set file = upload.files("file1")
if file.isfile then
result = file.saveToFile(savepath,1,true)
if result then
response.Write "上传成功"
filename1 = file.LocalName '赋值给filename1
filepath1 = server.MapPath(savepath & "/" & file.filename)
end if
end if

set file = upload.files("file2")
if file.isfile then
result = file.saveToFile(savepath,1,true)
if result then
filename2= file.LocalName
filepath2= server.MapPath(savepath & "/" & file.filename)
end if
end if

set file = upload.files("file3")
if file.isfile then
file.UserSetName = "jo-test"
result = file.saveToFile(savepath,1,true)
if result then
filename3 = file.LocalName


filepath3= server.MapPath(savepath & "/" & file.filename)

end if
end if

set file = nothing
end if
set upload = nothing
%>
<%
str1 = request.form("title")
str2 = request.form("ad")
str3 = request.form("date")
str4 = request.form("date2")
str5 = request.form("title2")
str6 = request.form("name1")
str7 = request.form("file")
str8 = request.form("file1")
str9 = request.form("file2")
str10 = request.form("file3")
str11 = request.form("year")
str12 = request.form("month")
str13 = request.form("day")



Session("s1") = str1
Session("s2") = str2
Session("s3") = str3
Session("s4") = str4
Session("s5") = str5
Session("s6") = str6
Session("s7") = str7
Session("s8") = str8
Session("s9") = str9
Session("s10") = str10
Session("s11") = str11
Session("s12") = str12
Session("s13") = str13
session("s14") = filename1%>

<a href = "file2.asp"> 请点击跳转</a>
[解决办法]
你改成这个组件的对象,我是猜的,组件一般都有收件表单和文件的对象。。

str1 = upload.forms("title")
str2 = upload.forms("ad")
str3 = upload.forms("date")
...


改成这样试试,不行贴出UpLoad_Class.asp的代码

读书人网 >ASP

热点推荐