Stubborn sessions and request.form

Hi,

I'm going in circles here.  It seems this worked fine until I went through it a second time, then it just stopped working.

I have a page login.asp.
On login.asp the directory path is stored in a variable called str
There is a link that opens a page in an inline frame which passes the variable str and gives it a sessiion name:

session("storedirectory") = str

I do a response.write session("storedirectory")  which shows up fine.
At first, it showed up on each consecutive page without a problem.  At the end, it passes the variable thriough a form which breaks out of the inline frame back to the current website and a specified file.

After the session did not work the second go round, I tried passing the str variable through a form field and requesting it on the next page, but it will not show up no matter what.

page 1:
<input type="text" name="xyz" size="30" maxlength="50" value="<%=session("storedirectory")%>">

page 2:
dim keepdirectory
keepdirectory = request.form("xyz")
response.write keepdirectory& "OK"

I added the "OK" to be sure that the "Internet was't broken"  (hee hee). and it shows up fine.
But the value does not which displays fine on page 1.


Heeeeeeeeeeeeeeeeeeelp! Please...
LVL 3
Insomniac_PhDAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
nurbekConnect With a Mentor Commented:
try to pass the variable as querystring

<form action="asppage.asp?mydir=<%=session("storedirectory")%>" method="post" enctype="multipart/form-data" name="form1">

also check the path redirecting tha page into frame
it should be relative path "page.asp"
not an absolute path "http://www.mydomain.com/page.asp"
0
 
ThogekCommented:
Silly question:
Is that form a method="get" or method="post"?
0
 
imnajamCommented:
does your page 1 have the <form method="post">
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Ryan ChongCommented:
How is your form tag on page 1? Make sure there is not enctype="multipart/form-data" on your form tag..

Post your page 1 here if necessary

regards
0
 
Ryan ChongCommented:
btw, you can always try:

keepdirectory = request("xyz")

instead
0
 
Insomniac_PhDAuthor Commented:
post
0
 
ThogekCommented:
If you View Source in your browser on page 1, what does the full <input type="text" ...> tag look like?  (I.e., does the value get written in there?
0
 
Insomniac_PhDAuthor Commented:
Yes, I can see it just fine when I view source code.

I started over and got rid of all my junk and comments.  Here is page 1 below.  I discovered that it is posting to itself then redirecting to the next page (page2) so this must have something to do with why the variable is not passing or why a form field will not pass??

Argghhh






<%
'/////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////
'This is the session variable that will not pass
session("directoryholder") = request.querystring("senditx")
session("directoryholder")
response.write session("directoryholder") 'This displays fine on this page.
'/////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////

Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<!--#include file="db.asp"-->
<!--#include file="aspmkrfn.asp"-->
<%
Response.Buffer = True

' Get action
a = Request.Form("a")
Select Case a
      Case "S": ' Get Search Criteria

      ' Build search criteria for advance search, remove blank field
      search_criteria = ""
      x_licensename = Request.Form("x_licensename")
      z_licensename = Request.Form("z_licensename")
      If x_licensename <> "" Then
            srchFld = x_licensename
            this_search_criteria = "x_licensename=" & Server.URLEncode(srchFld)
            this_search_criteria = this_search_criteria & "&z_licensename=" & Server.URLEncode(z_licensename)
      Else
            this_search_criteria = ""
      End If
      If this_search_criteria <> "" Then
            If search_criteria = "" Then
                  search_criteria = this_search_criteria
            Else
                  search_criteria = search_criteria & "&" & this_search_criteria
            End If
      End If
      x_domainname = Request.Form("x_domainname")
      z_domainname = Request.Form("z_domainname")
      If x_domainname <> "" Then
            srchFld = x_domainname
            this_search_criteria = "x_domainname=" & Server.URLEncode(srchFld)
            this_search_criteria = this_search_criteria & "&z_domainname=" & Server.URLEncode(z_domainname)
      Else
            this_search_criteria = ""
      End If
      If this_search_criteria <> "" Then
            If search_criteria = "" Then
                  search_criteria = this_search_criteria
            Else
                  search_criteria = search_criteria & "&" & this_search_criteria
            End If
      End If
      x_OrderNumber = Request.Form("x_OrderNumber")
      z_OrderNumber = Request.Form("z_OrderNumber")
      If x_OrderNumber <> "" Then
            srchFld = x_OrderNumber
            this_search_criteria = "x_OrderNumber=" & Server.URLEncode(srchFld)
            this_search_criteria = this_search_criteria & "&z_OrderNumber=" & Server.URLEncode(z_OrderNumber)
      Else
            this_search_criteria = ""
      End If
      If this_search_criteria <> "" Then
            If search_criteria = "" Then
                  search_criteria = this_search_criteria
            Else
                  search_criteria = search_criteria & "&" & this_search_criteria
            End If
      End If
            If search_criteria <> "" Then
                  Response.Clear
                  session("directoryholder")
                  Response.Redirect "licensegenlicenseslist.asp" & "?" & search_criteria
            End If
End Select

' Open Connection to the database
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
%>
<script language="JavaScript" src="ew.js"></script>
<script language="JavaScript">
<!-- start Javascript
function  EW_checkMyForm(EW_this) {
return true;
}
// end JavaScript -->
</script>
<form onSubmit="return FrontPage_Form1_Validator(this)"  action="licensegenlicensessrch.asp" method="post" language="JavaScript" name="FrontPage_Form1">
<input type="hidden" name="z_OrderNumber" value="=,','">
<input type="hidden" name="z_domainname" value="=,','">
<input type="hidden" name="z_licensename" value="=,','">
<p>
<input type="hidden" name="a" value="S">
<table border="0" cellspacing="0" cellpadding="1" bgcolor="#FFFFFF">
      <tr>
            <td bgcolor="#FFFFFF" colspan="2"><b><font face="Arial" size="2">Step 1
            of 5: Enter your Licensed Name and Order Number below:</font></b></td>
      </tr>
      <tr>
            <td bgcolor="#FFFFFF"><font face="Arial" size="2">
            <span class="appstyle" style="color: #0000FF;">Licensee</span><font color="#0000FF">&nbsp;</font></font></td>
            <td bgcolor="#FFFFFF"><span class="appstyle">
            <!--webbot bot="Validation" s-display-name="Your Licensed Name" b-value-required="TRUE" i-maximum-length="255" --><input type="text" name="x_licensename" size="30" maxlength="255" value="<%= Server.HTMLEncode(x_licensename&"") %>"></span>&nbsp;</td>
      </tr>
      <tr>
            <td bgcolor="#FFFFFF"><font face="Arial" size="2">
            <span class="appstyle" style="color: #0000FF;">Domain</span><font color="#0000FF">&nbsp;</font></font></td>
<%
dim myapplicationserver
getmydomainname = Request.querystring("myapplicationserver")
%>

            <td bgcolor="#FFFFFF"><span class="appstyle">
            &nbsp;<!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="255" --><input type="text" name="x_domainname" size="30" maxlength="255" value="<%=getmydomainname%>"></span>&nbsp;</td>
      </tr>
      <tr>
            <td bgcolor="#FFFFFF"><font face="Arial" size="2">
            <span class="appstyle" style="color: #0000FF;">Order Number</span><font color="#0000FF">&nbsp;</font></font></td>
            <td bgcolor="#FFFFFF"><span class="appstyle">
            <!--webbot bot="Validation" s-display-name="Your Order Number" b-value-required="TRUE" i-minimum-length="4" i-maximum-length="50" --><input type="text" name="x_OrderNumber" size="30" maxlength="50" value="<%= Server.HTMLEncode(x_OrderNumber&"") %>"></span>&nbsp;</td>
      </tr>
</table>
<p>
<input type="submit" name="Action" value="Continue to Step 3">
</form>
<%
conn.close
Set conn = nothing
%>
0
 
Insomniac_PhDAuthor Commented:
no that does nothing
0
 
Insomniac_PhDAuthor Commented:
No hold on, I'm getting something.... just a few minustes..
0
 
Insomniac_PhDAuthor Commented:
ok thanks...got it.  
0
 
Ryan ChongCommented:
instead of setting your variable using querystring like:

<form action="asppage.asp?mydir=<%=session("storedirectory")%>" method="post" enctype="multipart/form-data" name="form1">

why don't you put it as a hidden field, while you using POST method?
0
All Courses

From novice to tech pro — start learning today.