Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Stubborn sessions and request.form

Posted on 2004-10-27
12
Medium Priority
?
302 Views
Last Modified: 2012-05-05
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...
0
Comment
Question by:Insomniac_PhD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 15

Expert Comment

by:Thogek
ID: 12430520
Silly question:
Is that form a method="get" or method="post"?
0
 
LVL 9

Expert Comment

by:imnajam
ID: 12430527
does your page 1 have the <form method="post">
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12430530
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12430535
btw, you can always try:

keepdirectory = request("xyz")

instead
0
 
LVL 3

Author Comment

by:Insomniac_PhD
ID: 12430565
post
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12430606
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
 
LVL 3

Author Comment

by:Insomniac_PhD
ID: 12430990
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
 
LVL 13

Accepted Solution

by:
nurbek earned 2000 total points
ID: 12431038
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
 
LVL 3

Author Comment

by:Insomniac_PhD
ID: 12433067
no that does nothing
0
 
LVL 3

Author Comment

by:Insomniac_PhD
ID: 12433271
No hold on, I'm getting something.... just a few minustes..
0
 
LVL 3

Author Comment

by:Insomniac_PhD
ID: 12434187
ok thanks...got it.  
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12440669
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

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question