Results 1 to 7 of 7

Thread: passing session variables to the next web page

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    16

    passing session variables to the next web page

    hi i have created a session id at the time of login....now how can i pass this session variable to the next page???

  2. #2
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: passing session variables to the next web page

    Since Session variables are stored at server side, so once you create and set a Session variable, they all are accessible across whole application. You do not need to pass them from page-to-page.
    Show Appreciation. Rate Posts.

  3. #3
    New Member
    Join Date
    May 2007
    Posts
    2

    Re: passing session variables to the next web page

    I'm having a similar problem.
    In my first page, I have:

    Session("Country_ID") = ComboCountry.SelectedValue
    Session("Region_ID") = ComboRegion.SelectedValue


    In my next page I have:

    Response.write(Session("Country_ID"))
    Response.write(Session("Region_ID"))

    And it prints 2 blank lines

    Any idea why?

    Thanks

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: passing session variables to the next web page

    Does ComboCountry.SelectedValue actually have a value? Set a breakpoint and check it.

  5. #5
    Member
    Join Date
    May 2007
    Posts
    32

    Re: passing session variables to the next web page

    use this
    Code:
    session(country_id)= ComboCountry.SelectedItem.Text

  6. #6
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: passing session variables to the next web page

    Quote Originally Posted by shadowcodes
    use this
    Code:
    session(country_id)= ComboCountry.SelectedItem.Text
    It's not necessary for the Value member to be the same as the display member.

    Back to the original question.
    Check if the SessionState part in the Web.config file is set properly
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  7. #7
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: passing session variables to the next web page

    Here is how it should look like. (Unless you need to do some changes)
    HTML Code:
    <sessionState cookieless="false" timeout="20" mode="InProc"></sessionState>
    And make sure you are not calling "Session.Clear" or "Session.Abandon" anywhere in your code unless you want all session variables to loose their values
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width