|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Response.redirect with a variable
I don't see where I'm going wrong. The code is simple...
Code:
Response.Redirect mstrSiteMainSecure & "/UploadVTtext.asp?PhotoNumber=" & PhotoNumber When I get to the next page I get http//MyServer/UploadVTtext.asp?PhotoNumber= The variable is missing. I've used the variable in a Response.write on the page and it is accurate. It's a number from 1 to 16, if that makes a difference. I've also checked the page many times to make sure that it hasn't been set to a value of "" and tried to set and use a session variable. No luck. I would place all the code here, but it has 300 lines. Any ideas.... Thanks Tom |
|
#2
|
||||
|
||||
|
Tom,
I know its 300 lines long but it may help if we could see your whole code. Also, I dont mean to be patronising but the variables definately called PhotoNumber? Its shouldn't be request.form("PhotoNumber") or anything? |
|
#3
|
|||
|
|||
|
Here's the whole file. I'm going blind rereading it.
Code:
<% Option Explicit
Response.Expires = -1000 ' Make browser not cache pg.
Response.Buffer = True ' Buffer content so Response.Redirect will work.
%>
<!-- #include file="~incl/ShadowUploader.asp" -->
<!--#include file="~incl/~config.asp"-->
<!--#include file="~incl/jpsutility.asp"-->
<!--#include file="~incl/menu.asp"-->
<!--#include file="~incl/misc.asp"-->
<%
Dim UserID
Dim MLS_ID, ListingNumber
Dim objUpload, x, filename, extpos, ext
Dim objConn
Dim VT
Dim Photo1Name, Photo1Text
Dim Photo2Name, Photo2Text
Dim Photo3Name, Photo3Text
Dim Photo4Name, Photo4Text
Dim Photo5Name, Photo5Text
Dim Photo6Name, Photo6Text
Dim Photo7Name, Photo7Text
Dim Photo8Name, Photo8Text
Dim Photo9Name, Photo9Text
Dim Photo10Name, Photo10Text
Dim Photo11Name, Photo11Text
Dim Photo12Name, Photo12Text
Dim Photo13Name, Photo13Text
Dim Photo14Name, Photo14Text
Dim Photo15Name, Photo15Text
Dim Photo16Name, Photo16Text
Dim Style
Dim NumOfPhotos
Dim Background
Dim Stripe1
Dim Font
Dim FontColor
Dim strValid
Dim PhotoNumber
Dim HouseNumber, StreetName
Dim strSQL, objRS
' Open conn.
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open mstrConn
PhotoNumber = Request.QueryString("PhotoNumber")
Call SetVar()
ListingNumber = session("ListingNumber")
Dim objFSO, strFolderPath
Set objFSO= Server.CreateObject("Scripting.FileSystemObject")
strFolderPath = Server.MapPath("images/VT/" & ListingNumber)
If Not objFSO.FolderExists(strFolderPath) then
objFSO.CreateFolder(strFolderPath)
End If
If Request("action")="1" Then
Set objUpload=New ShadowUpload
If objUpload("upload") = "Upload" Then
If objUpload.GetError<>"" Then
Response.Write("Sorry, could not upload: "&objUpload.GetError)
Elseif objUpload.FileCount = 0 Then
Response.Write("<B>Sorry, could not upload: Please select a file</B>")
Else
Response.Write("found "&objUpload.FileCount&" files...<br />")
For x=0 To objUpload.FileCount-1
Response.Write("file name: "&objUpload.File(x).FileName&"<br />")
Response.Write("file type: "&objUpload.File(x).ContentType&"<br />")
Response.Write("file size: "&objUpload.File(x).Size&"<br />")
filename = objUpload.File(x).FileName
extpos = InStrRev(filename, ".")-1
ext = Right(filename, len(filename)-extpos)
filename = PhotoNumber
filename = filename & ext
Response.Write "File saved as: <b>" & filename & "</b><br>"
'Response.End
Call objUpload.File(x).SaveToDisk(Server.MapPath("images/VT/" & ListingNumber), filename)
Response.Write("File saved successfully!")
Response.Write("<hr />")
Next
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder(Server.MapPath("/templates/VT/"))
fo.Copy Server.MapPath("images/VT/" & ListingNumber), true
set fo=nothing
set fs=nothing
Response.Redirect mstrSiteMainSecure & "/UploadVTPhoto.asp?PhotoNumber=" & PhotoNumber
End If
Elseif objUpload("btnClose") <> "" Then ' Close btn.
' Close.
Call NextPg()
Elseif objUpload("btn360") <> "" Then ' Close btn.
' Close.
Response.Redirect mstrSiteMainSecure & "/UploadVT_Mov.asp?PhotoNumber=" & PhotoNumber
Else
' ShowPage.
End If
End If
' - - - - -
Function NextPg()
' Go to pg.
' (UploadVTtext1.asp)
Response.Redirect mstrSiteMainSecure & "/UploadVTtext.asp?PhotoNumber=" & PhotoNumber
End Function
' - - - - -
Function SetVar()
' Set var.
ListingNumber = session("ListingNumber")
' Set sql.
strSQL = "SELECT * "
strSQL = strSQL & "FROM tblListings "
strSQL = strSQL & "WHERE (1=1) "
strSQL = strSQL & "AND (ListingNumber=" & Chr(39) & jpsvbFixSQL(ListingNumber) & Chr(39) & ") "
' Open rs.
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
' If no recs.
If objRS.EOF Then
' Close rs.
objRS.Close
Set objRS = Nothing
' Msg.
Response.Write "<script type='text/javascript'>alert('No records matched the criteria.\n\nYou may continue with the new record or else close the page.');</script>"
Else
' Move to 1st (and probably only) rec.
' objRS.MoveFirst
' Set var.
VT = jpsvbNullToBlank(objRS("VT"))
Photo1Name = jpsvbNullToBlank(objRS("Photo1Name"))
Photo1Text = jpsvbNullToBlank(objRS("Photo1Text"))
Photo2Name = jpsvbNullToBlank(objRS("Photo2Name"))
Photo2Text = jpsvbNullToBlank(objRS("Photo2Text"))
Photo3Name = jpsvbNullToBlank(objRS("Photo3Name"))
Photo3Text = jpsvbNullToBlank(objRS("Photo3Text"))
Photo4Name = jpsvbNullToBlank(objRS("Photo4Name"))
Photo4Text = jpsvbNullToBlank(objRS("Photo4Text"))
Photo5Name = jpsvbNullToBlank(objRS("Photo5Name"))
Photo5Text = jpsvbNullToBlank(objRS("Photo5Text"))
Photo6Name = jpsvbNullToBlank(objRS("Photo6Name"))
Photo6Text = jpsvbNullToBlank(objRS("Photo6Text"))
Photo7Name = jpsvbNullToBlank(objRS("Photo7Name"))
Photo7Text = jpsvbNullToBlank(objRS("Photo7Text"))
Photo8Name = jpsvbNullToBlank(objRS("Photo8Name"))
Photo8Text = jpsvbNullToBlank(objRS("Photo8Text"))
Photo9Name = jpsvbNullToBlank(objRS("Photo9Name"))
Photo9Text = jpsvbNullToBlank(objRS("Photo9Text"))
Photo10Name = jpsvbNullToBlank(objRS("Photo10Name"))
Photo10Text = jpsvbNullToBlank(objRS("Photo10Text"))
Photo11Name = jpsvbNullToBlank(objRS("Photo11Name"))
Photo11Text = jpsvbNullToBlank(objRS("Photo11Text"))
Photo12Name = jpsvbNullToBlank(objRS("Photo12Name"))
Photo12Text = jpsvbNullToBlank(objRS("Photo12Text"))
Photo13Name = jpsvbNullToBlank(objRS("Photo13Name"))
Photo13Text = jpsvbNullToBlank(objRS("Photo13Text"))
Photo14Name = jpsvbNullToBlank(objRS("Photo14Name"))
Photo14Text = jpsvbNullToBlank(objRS("Photo14Text"))
Photo15Name = jpsvbNullToBlank(objRS("Photo15Name"))
Photo15Text = jpsvbNullToBlank(objRS("Photo15Text"))
Photo16Name = jpsvbNullToBlank(objRS("Photo16Name"))
Photo16Text = jpsvbNullToBlank(objRS("Photo16Text"))
Style = jpsvbNullToBlank(objRS("Style"))
If Style="gotham" then Style="GH" End If
NumOfPhotos = jpsvbNullToBlank(objRS("NumOfPhotos"))
Background = jpsvbNullToBlank(objRS("Background"))
Stripe1 = jpsvbNullToBlank(objRS("Stripe1"))
Font = jpsvbNullToBlank(objRS("Font"))
FontColor = jpsvbNullToBlank(objRS("FontColor"))
HouseNumber = jpsvbNullToBlank(objRS("HouseNumber"))
StreetName = jpsvbNullToBlank(objRS("StreetName"))
session("Photo1Name") = Photo1Name
session("Photo1Text") = Photo1Text
session("Style") = Style
session("NumOfPhotos") = NumOfPhotos
session("Background") = Background
session("Stripe1") = Stripe1
session("Font") = Font
session("FontColor") = FontColor
session("PhotoNumber") = PhotoNumber
' Close rs.
objRS.Close
Set objRS = Nothing
End If
End Function
' - - - - - -
%>
<html>
<head>
<meta name="robots" content="noindex,nofollow">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="page-enter" content="revealTrans(duration=<%= mintTransitionSec %>,transition=<%= mintTransitionNum %>)">
<link rel="stylesheet" type="text/css" href="<%= mstrSiteMainSecure %>/~incl/style.css">
<script type="text/javascript" src="<%= mstrSiteMainSecure %>/~incl/jpsutility.js"></script>
<title><%= mstrSiteTitle %> - Upload Virtual Tour Photo 1</title>
</head>
<body bgcolor="<%= mstrColorMain %>" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<% ' Show title table.
Call ShowTitle("100%", "all", True)
' Flush buffer.
Response.Flush
%>
<% ' Outer Table. %>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td bgcolor="<%= mstrColorMenu %>" valign="top">
<% ' Show menu table.
Call ShowMenu(True)
%>
</td>
<td valign="top" width="100%">
<% ' Main Table. %>
<table cellpadding="1" cellspacing="1" width="100%">
<tr>
<td style="font-size:16pt; font-weight:bold" align="center" valign="top" colspan="20">
</td>
</tr>
<tr>
<td colspan="20">
<%= SpaceIt(1, 1, True, True) %>
</td>
</tr>
<tr>
<td style="font-size:16pt; font-weight:bold" align="left" valign="top" width="20%">
<% ' ********** Show VT menu table. ************* %>
<% ' Show Virtual Tour menu table.
Call VT_Menu(True)
%>
</td>
<% ' ******** Show page -- Upload Photos. *********************** %>
<td style="font-size:10pt; font-weight:bold" align="center" valign="middle" width="100%">
<center>
<form action="<%=Request.ServerVariables( "Script_Name" )%>?action=1" enctype="multipart/form-data" method="POST"><br />
<strong>You're adding or changing photo <%Response.Write PhotoNumber %> of your Virtual Tour for <%Response.Write session("HouseNumber") & " " & session("StreetName")%><br /><br />
<img height="160" border="3" src="images/VT/<%Response.Write session("ListingNumber")%>/<%Response.Write PhotoNumber %>.JPG"><br>
<br />
Please Upload your new photo.<br /></strong><br /><br />
<strong>Select File:</strong> <input type="file" name="file1" /><br />
<br />
<% ' *** btnUpload %>
<input type="submit" name="upload" value="Upload">
<% ' *** btnClose %>
<input type="submit" name="btnClose" value="Next Page" class="cssclsNoPrint">
<P>Would you like to add a 360° Panoramic Image for this photo?<br>
<% ' *** btn360 %>
<input type="submit" name="btn360" value=" Add Panorama ">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<% ' Show footer table.
Call ShowFooter("100%", "all", True)
%>
</body>
</html>
I hope you can find what I did wrong. Thanks, Tom Last edited by tomvangundy : May 13th, 2008 at 01:02 AM. |
|
#4
|
|||
|
|||
|
your photonumber is collected from the querystring of the previous page
PhotoNumber = Request.QueryString("PhotoNumber") are you sending the photnumber in the previous page also youve defined a session as the photonumber variable instead of using your querystring, degine the photonumber in the session at the first page containing the photonumber then use your session to collect the photonumber if you response.write the variable what you get Code:
response.write PhotoNumber response.end() |
|
#5
|
||||
|
||||
|
Sorry,
I'm not really familiar with that code, I can't see anything obviously wrong. What happens if you try using the value of the session variable instead? Code:
Response.Redirect(mstrSiteMainSecure & "/UploadVTPhoto.asp?PhotoNumber=" & Session("PhotoNumber"))
|
|
#6
|
|||
|
|||
|
It worked with editing the file before this one, then editing this one to remove the line
Code:
session("PhotoNumber") = PhotoNumber
I edited the earlier post and showed this line in red. In the next page I'll place a line that says Code:
session("PhotoNumber") = session("PhotoNumber") +1
This should do it. I can't find it but apparently somewhere in my coding I was wiping out the value for PhotoNumber any time I pressed any of the submit buttons. Thanks for the help! Tom |
|
#7
|
|||
|
|||
|
Back again....
Now when I click on the Menu table (static href links) the session("PhotoNumber") is wrong. I have to find out why the variable is lost when I click on a button. This is even for the ShadowUploader. Any ideas?... |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Response.redirect with a variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|