Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 July 18th, 2006, 04:58 AM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default session

hi,

i am new to ASP.my problem is when i create session. the value in the session is expired soon.session value is null in all the pages.this is my code
where i am validating the values entered in the textbox
dim con
set con=server.CreateObject("ADODB.Connection")
con.open strDB '' connectionstring

dim uname,pwd
uname=Request.Form("txtuser")
pwd=Request.Form("txtpwd")
Response.Write(uname&" <br>" & pwd & "<br>")

dim rs
set rs=Server.CreateObject("ADODB.Recordset")
rs.open con.Execute("Select * from Adminlogin where A_Username='"&trim(uname)&"' and A_pwd='"&trim(pwd)&"' ")
    if rs.EOF then
        Response.Write("Invaid Login Details")
    else
        Session("LoggedInUser") =rs("A_Username")
        Response.Redirect("Admin Control Panel.asp")


    end if '' end if of rs record set



this is another page's code

If Session("LoggedInUser") = "" Then
    Response.Redirect("../default.htm")
End If
session value is always null in this page.

textboxes are in default.htm page.


thanks in advance






 
Old July 18th, 2006, 08:12 AM
Authorized User
 
Join Date: Feb 2006
Location: Verona, Italy, Italy.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,!

Code:
if rs.EOF then
        Response.Write("Invaid Login Details")
    else
        Session("LoggedInUser") =rs("A_Username")

        response.write (rs("A_Username"))
        response.write (Session("LoggedInUser")) 
        response.end 
        Response.Redirect("Admin Control Panel.asp")
    end if '' end if of rs record set


try now

Steweb




Visit my web site !
www.steweb.net
 
Old July 19th, 2006, 05:53 AM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,


response.write (rs("A_Username"))
response.write (Session("LoggedInUser"))

this line of code is working.displaying username.but when this page is redirected

example: Response.Redirect("Admin Control Panel.asp")

Admincontrolpage.asp page is opened

response.write (Session("LoggedInUser")) this code is not working.session value is not printed.

session value is null in Admincontrolpage.asp page

thank u steweb







 
Old July 19th, 2006, 10:56 AM
Authorized User
 
Join Date: Feb 2006
Location: Verona, Italy, Italy.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

MMM...

maby you use a browser Firefox or netscape ?
Because this browser view the session variable with a cookie !

In first page print value but not working in another page

check your cookies !

Steweb




Visit my web site !
www.steweb.net
 
Old July 20th, 2006, 04:33 AM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

my browser is IE5.







Similar Threads
Thread Thread Starter Forum Replies Last Post
session komalpriya .NET Framework 2.0 4 October 30th, 2007 09:16 AM
session and cookie problem (empty session file) msincan BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 27th, 2005 05:31 PM
session help -Dman100- Classic ASP Basics 1 November 29th, 2004 12:45 AM
About Session mani_he Beginning PHP 7 September 18th, 2004 03:47 PM
Session quinn Classic ASP Basics 12 November 19th, 2003 10:42 AM





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