Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9260307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:51:31+00:00 2026-06-18T12:51:31+00:00

I am having problems with session After a user selects smth from drop down

  • 0

I am having problems with session

After a user selects smth from drop down menu I have to insert that value to session.
I need that value to get to the database for auth tables in model (it crashes when I go to login/register form if I read from request.var). Where do I insert the value in session and how (view, controler).

For now I solved it using cookies but it is not the most secure.

Any suggestions=

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:51:32+00:00Added an answer on June 18, 2026 at 12:51 pm

    session is another instance of the Storage class. Whatever is stored into session for example:

    session.myvariable = "hello"
    

    can be retrieved at a later time:

    a = session.myvariable
    

    In other words, it’s already there – just assign variables to it..
    If you wish to use the database you have to define a session table in your DB through model.
    Quote from web2py manual:

    For example to store sessions in the database:

    session.connect(request, response, db, masterapp=None)
    

    where db is the name of an open database connection (as returned by the DAL). It tells web2py that you want to store the sessions in the database and not on the filesystem. session.connect must come after db=DAL(…), but before any other logic that requires session, for example, setting up Auth.

    web2py creates a table:

    db.define_table('web2py_session',
                 Field('locked', 'boolean', default=False),
                 Field('client_ip'),
                 Field('created_datetime', 'datetime', default=now),
                 Field('modified_datetime', 'datetime'),
                 Field('unique_key'),
                 Field('session_data', 'text'))
    

    and stores cPickled sessions in the session_data field.

    The option masterapp=None, by default, tells web2py to try to retrieve an existing session for the application with name in request.application, in the running application.

    If you want two or more applications to share sessions, set masterapp to the name of the master application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problems with retrieving multiple instances of a session variable from an InProc
I'm having problems with cookies on my website. After validating user credentials, the following
I'm having problems with dynamic partial view data disappearing from the textbox after a
Im having problems with classpaths. I have used them before with import but I'm
I am using FormsAuthentication for userlogin. I am having a problem after user logs
I have a comments form on my site. After the user submits the form,
I have a mobile application that I'm using with Facebook connect. I'm having trouble
I have an MVC3 application, in which the user is sent an email, having
I am having problem with a session variable. The problem is that with a
I've having a problem with an Array that I'm storing in the session variables.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.