Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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






Reply With Quote
  #2 (permalink)  
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
Reply With Quote
  #3 (permalink)  
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







Reply With Quote
  #4 (permalink)  
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
Reply With Quote
  #5 (permalink)  
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.



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.