Bizzare session variable issue

B

bill joyce

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
 
N

Natty Gur

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
 
B

billj2

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
 
B

bill joyce

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top