session expires after logged in

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rahemeen
    New Member
    • Sep 2007
    • 11

    #16
    [code=vbnet]
    If Not IsPostBack Then

    If Not Session("USERID ") Is Nothing Then
    If String.Compare( Session("ROLE") , "Retailer") = 0 Then
    strUSERID = Session("USERID ")
    Else
    Response.Redire ct("usercp.aspx ")
    End If
    Else
    Response.Redire ct("UserLogin.a spx")
    End If
    FillBrands()
    End If
    [/code]
    the above code works fine page is not expiring until sign out but server side action on page like loading data on dropdownlist not working.

    as i am loading brands in one dropdownlist and when we choose any brand from the list it will load product names in another dropdownlist which is not happening if i use above code. but the problem of session expire is not happening with this code. just clarify me that which method is true code to check the login and role should be kept inside if not ispostback then .... end if or outside.
    Last edited by Frinavale; Nov 1 '07, 01:10 PM. Reason: Added [code] tags to make more legible

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #17
      Originally posted by rahemeen
      [code=vbnet]
      If Not IsPostBack Then

      If Not Session("USERID ") Is Nothing Then
      If String.Compare( Session("ROLE") , "Retailer") = 0 Then
      strUSERID = Session("USERID ")
      Else
      Response.Redire ct("usercp.aspx ")
      End If
      Else
      Response.Redire ct("UserLogin.a spx")
      End If
      FillBrands()
      End If
      [/code]
      the above code works fine page is not expiring until sign out but server side action on page like loading data on dropdownlist not working.

      as i am loading brands in one dropdownlist and when we choose any brand from the list it will load product names in another dropdownlist which is not happening if i use above code. but the problem of session expire is not happening with this code. just clarify me that which method is true code to check the login and role should be kept inside if not ispostback then .... end if or outside.
      I would check that the user is logged in and within the roles Every page request. This means that I would not put it within the if not IsPostBack.

      As for your second DropDownList not filling....plea se post the method that handles your first DropDownList post back event so that we can have a better look at what's going on.

      Also, in the future, could you please post your code within [code] tags.
      For example, if I were to post VB.NET code I would type the following:
      [code=vb net]
      'My VB.NET Code Pasted Here
      [/code]


      Thanks

      -Frinny

      Comment

      Working...