Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 20th, 2004, 07:48 AM
Registered User
 
Join Date: May 2004
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default session variable assigning problem

Hi guys,

I’m facing some problem can u solve it.

Problem is:
I’m giving user Id and password in (Login_sess.asp) and submit it to page (sess_test.asp). I am setting session variable (session(“Sin”)=”Yes”) just before redirecting to the same page, but in first time I do not received the value of session variable when I redirect it, when I execute this process second time or redirect it only with the page name (sess_test.asp) it receives session value.

Can you tell me what’s the problem?
I’ve to receive session value in first time and have to redirect with compete URL


Login_sess.asp (Page is)

<%@ Language=VBScript %>
<html><head>
<title>Login </title>
</head>
<h1 align=center>Login in Your Account </h1>
<BODY>
<form name=login method=post action=sess_test.asp >
<table width=40%>
<tr><td colspan=2>Type Your ID and Password</td></tr>
<tr><td>Enter Your ID</td><td><INPUT type="text" id=txtUID name=txtUID ></td></tr>
<tr><td>Password </td><td><INPUT type="text" id=txtPwd name=txtPwd ></td></tr>
</table>

<table width=40%><tr><td align=center><INPUT type="submit" value="Submit" id=submit name=submit>
&nbsp&nbsp <INPUT type="reset" value="Reset" id=reset name=reset > </td></table>
</form></BODY></HTML>


Sess_test.asp (file is)
<%@ Language=VBScript %>
<html><head><title>Main Page </title></head>
<body><form method=get>
<%Response.Write "session Variable =" & Session("Sin")
if Request("txtUID") <> "" then
            Session("Sin")="Yes"
            Response.Redirect "http://localhost/sg/sess_test.asp"
            'Response.Redirect "sess_tes.asp"
end if %>
<br><A href="Login_sess.asp">Sin In</A>
</body></form>
</HTML>



regards,
farooq












azeem
 
Old November 22nd, 2004, 06:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:but in first time I do not received the value of session variable when I redirect it
So what do you see the first time? Do you see The page cannot be displayed error? If so check if the path specified in response.redirect() within sess_test.asp

It works fine for me. It is better you use QUOTES around the values within the <form>, <input> tags, which is seen inconsistent in the code that you posted(login_sess.asp).
Code:
<%@ Language=VBScript %>
<html><head>
<title>Login  </title>
</head>
<h1 align=center>Login in Your Account  </h1>
<BODY>
<form name="login" method="post" action="sess_test.asp">
<table width=40%>
<tr><td colspan=2>Type Your ID and Password</td></tr>
<tr><td>Enter Your ID</td><td><INPUT type="text" id="txtUID" name="txtUID"></td></tr>
<tr><td>Password </td><td><INPUT type="text" id="txtPwd" name="txtPwd"></td></tr>
</table>

<table width=40%><tr><td align=center><INPUT type="submit" value="Submit" id="submit" name="submit">
&nbsp&nbsp <INPUT type="reset" value="Reset" id="reset" name="reset"> </td></table>
</form></BODY></HTML>
_________________________
- Vijay G
Strive for Perfection
 
Old November 27th, 2004, 06:07 AM
Registered User
 
Join Date: May 2004
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi,

That is working in my PC but problem is that when I open Internet Explorer first time it do not receive session variable but next time or on word it works fine .Again when I close the IE and reopen it. It does not work again for first time.

Please u check it in your PC for first time and inform me what could be the cause
I m not using any certification
Both files are reside in one folder
It do not gives any error just not receive the value


azeem
 
Old December 1st, 2004, 04:37 PM
Authorized User
 
Join Date: Nov 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<%@ Language=VBScript %>
<html><head><title>Main Page </title></head>
<body><form method=get>
<%
if Request("txtUID") <> "" then

            Session("Sin")="Yes"
            Response.Write "session Variable =" & Session("Sin")
            'Response.Redirect "http://localhost/sg/sess_test.asp"
            'Response.Redirect "sess_tes.asp"
end if %>
<br><A href="Login_sess.asp">Sign In</A>
</body></form>
</HTML>





THE THING YOU WERE DOING WRONG IS THAT YOU WERE FIRST TRYING TO PRINT THE SESSION= YES...BUT THE MISTAKE WAS FIRST YOU WANT TO PRINT THE VALUE AND THEN YOU ARE ASSIGNING...OBVIOUSLY FIRST TIME IT WILL GIVE YOU BLANK VALUE AND SECOND TIME WHEN YOU RUN IT THEN HAVE AN ASSIGNED VALUE WHICH IT WILL PRINT...

Hope it will work 4 u

Farzan Q.
BS(TeleCommunication)
Iqra University.
 
Old December 2nd, 2004, 02:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Has this been solved?

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
Assigning Javascript variable to ASP session anaden Classic ASP Basics 2 September 18th, 2004 02:16 AM
Another Session Variable Problem [email protected] Classic ASP Databases 1 August 1st, 2004 03:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.