Bizzare session variable issue

Discussion in 'ASP .Net' started by bill joyce, Oct 18, 2003.

  1. bill joyce

    bill joyce Guest

    I have an app that was running (about 5 pages). I have a session var in
    page load (see below) that I use to make sure people login. I added two
    pages to the application, on these two pages the session variable is not
    being recognized after the first postback. The older pages work fine.

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    If Session("LoggedIn") = False Then
    Response.Redirect("Login.aspx")
    End If

    If Not IsPostBack Then
    Call GetCustomerList()
    End If

    AddHandler cmbCustomer.SelectedIndexChanged, AddressOf
    GetAssemblies
    AddHandler cmbAssembly.SelectedIndexChanged, AddressOf
    GetWorkFlow
    End Sub

    Thanks
    Bill



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    bill joyce, Oct 18, 2003
    #1
    1. Advertising

  2. bill joyce

    Natty Gur Guest

    Hi,

    the added page are aspx page, right ? not asp.
    if so for some reasone your application recycled. the common case is
    writting somthing to the bin folder. check also the event log for
    application recycaling.

    by the way this senario is classic to use OO and build basic page class
    that will handle your needs and derived from Page class. all pages in
    your project can derived from your page base class thus preform the base
    class functionallity without duplicating code.

    Natty Gur[MVP]
    Phone Numbers:
    Office: +972-(0)9-7740261
    Fax: +972-(0)9-7740261
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur, Oct 18, 2003
    #2
    1. Advertising

  3. bill joyce

    billj2 Guest

    Hello Natty,

    thanks for the input. What I did was to put the "if
    session("loggedin") = false AFTER the NOT ISPostback code.

    If not ispostback then
    if session("loggedin") = false then
    response.redirect("login.aspx")
    end if
    end if

    This worked, I don't know why, that is not the way I have it coded in
    the other pages as shown below.

    Thanks
    Bill


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    billj2, Oct 18, 2003
    #3
  4. bill joyce

    bill joyce Guest

    Well this did not work either. After a second post back the session
    variable was lost and I went back to login.

    I tried this, I made a whole new project added the pages and I STILL
    lost that session variable. I went into IIS and removed the login.aspx
    from the document List. This stopped the application from going back to
    the login page after the second post back. THERE has to be an error on
    the page somewhere. Has anyone ran into this before, I am totally
    confused on this one.

    Also, this behavoir does not happpen on my p.c. It only happens on the
    production server which has the same IIS I have (5.0) and the same
    version of the framework.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    bill joyce, Oct 20, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Keith-Earl
    Replies:
    1
    Views:
    1,965
    Peter O'Reilly
    May 3, 2004
  2. Replies:
    0
    Views:
    446
  3. JavaEnquirer

    Bizzare web start problem

    JavaEnquirer, Aug 24, 2005, in forum: Java
    Replies:
    3
    Views:
    1,560
    JavaEnquirer
    Aug 25, 2005
  4. Replies:
    0
    Views:
    329
  5. Kelly

    ASPImage: bizzare concat issue

    Kelly, Feb 8, 2006, in forum: ASP General
    Replies:
    0
    Views:
    126
    Kelly
    Feb 8, 2006
Loading...

Share This Page