Session data

G

Guest

Hi,

I am developing an application with framesets (header, left navigation, and
content). Each frameset loads an ".aspx" page, and in one of these pages, I
store some information in the Session object, as follows:

....
Session["ABC"] = false;
....

When the page has finished loading, I click on a link button that opens a
Modal window, in which I am trying to access the Session information stored
before. However, this does not always work. Sometimes, the Session object is
empty and the information not available. I am not using Output caching.

Do you know what the problem could be?

Thanks.
Mike
 
H

Hermit Dave

The problem is simple each frame acts as a instance of browser so instead of
sharing the session there might be instances where it sort of gets messed
up.
Avoid using frames if possible. User controls are a better approach to the
solution

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
G

Guest

Hi Dave,

Thanks for the explanation.

What if I would store the information in the Application object and then
store in the Session object of each page in each frame?
Unfortunately, I cannot change the page layout, so I need to stick to frames.

Thanks.
Mike



Hermit Dave said:
The problem is simple each frame acts as a instance of browser so instead of
sharing the session there might be instances where it sort of gets messed
up.
Avoid using frames if possible. User controls are a better approach to the
solution

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
Mike said:
Hi,

I am developing an application with framesets (header, left navigation,
and
content). Each frameset loads an ".aspx" page, and in one of these pages,
I
store some information in the Session object, as follows:

...
Session["ABC"] = false;
...

When the page has finished loading, I click on a link button that opens a
Modal window, in which I am trying to access the Session information
stored
before. However, this does not always work. Sometimes, the Session object
is
empty and the information not available. I am not using Output caching.

Do you know what the problem could be?

Thanks.
Mike
 
H

Hermit Dave

was i would suggest is that if its common data to be used between number of
users only then consider application / cache.
Infact use Cache object instead of using Application object.
Also put checks in your code before you access session variables

int myInt;
if(Session("variable") != null)
{
// then read it
myInt = (int)Session("variable");
}
else
{
// fetch the data again say from db or xml file or whatever datastore
you use
myInt = myclass.mymethodcall();
}

you can still keep the same layout. as the page using user controls.
say you have your top menu / left hand menu.
copy the controls from that page and put it in a user control.
now in your main page. say use a table set the column and drop the user
control.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
Mike said:
Hi Dave,

Thanks for the explanation.

What if I would store the information in the Application object and then
store in the Session object of each page in each frame?
Unfortunately, I cannot change the page layout, so I need to stick to
frames.

Thanks.
Mike



Hermit Dave said:
The problem is simple each frame acts as a instance of browser so instead
of
sharing the session there might be instances where it sort of gets messed
up.
Avoid using frames if possible. User controls are a better approach to
the
solution

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
Mike said:
Hi,

I am developing an application with framesets (header, left navigation,
and
content). Each frameset loads an ".aspx" page, and in one of these
pages,
I
store some information in the Session object, as follows:

...
Session["ABC"] = false;
...

When the page has finished loading, I click on a link button that opens
a
Modal window, in which I am trying to access the Session information
stored
before. However, this does not always work. Sometimes, the Session
object
is
empty and the information not available. I am not using Output caching.

Do you know what the problem could be?

Thanks.
Mike
 
G

Guest

I see what you mean.

Just an additional question. Is the Session object stored for each pages?
So, in my case, each of the ".aspx" pages in each frame could contain a
different Session object. Is that correct?

Thanks.
Mike



Hermit Dave said:
was i would suggest is that if its common data to be used between number of
users only then consider application / cache.
Infact use Cache object instead of using Application object.
Also put checks in your code before you access session variables

int myInt;
if(Session("variable") != null)
{
// then read it
myInt = (int)Session("variable");
}
else
{
// fetch the data again say from db or xml file or whatever datastore
you use
myInt = myclass.mymethodcall();
}

you can still keep the same layout. as the page using user controls.
say you have your top menu / left hand menu.
copy the controls from that page and put it in a user control.
now in your main page. say use a table set the column and drop the user
control.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
Mike said:
Hi Dave,

Thanks for the explanation.

What if I would store the information in the Application object and then
store in the Session object of each page in each frame?
Unfortunately, I cannot change the page layout, so I need to stick to
frames.

Thanks.
Mike



Hermit Dave said:
The problem is simple each frame acts as a instance of browser so instead
of
sharing the session there might be instances where it sort of gets messed
up.
Avoid using frames if possible. User controls are a better approach to
the
solution

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)

Hi,

I am developing an application with framesets (header, left navigation,
and
content). Each frameset loads an ".aspx" page, and in one of these
pages,
I
store some information in the Session object, as follows:

...
Session["ABC"] = false;
...

When the page has finished loading, I click on a link button that opens
a
Modal window, in which I am trying to access the Session information
stored
before. However, this does not always work. Sometimes, the Session
object
is
empty and the information not available. I am not using Output caching.

Do you know what the problem could be?

Thanks.
Mike
 
H

Hermit Dave

not always... its a client side thing.
if done in a proper way they should and would share the same session cookie
but you could have instances where it all goes horribly wrong and each might
have its own session.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
Mike said:
I see what you mean.

Just an additional question. Is the Session object stored for each pages?
So, in my case, each of the ".aspx" pages in each frame could contain a
different Session object. Is that correct?

Thanks.
Mike



Hermit Dave said:
was i would suggest is that if its common data to be used between number
of
users only then consider application / cache.
Infact use Cache object instead of using Application object.
Also put checks in your code before you access session variables

int myInt;
if(Session("variable") != null)
{
// then read it
myInt = (int)Session("variable");
}
else
{
// fetch the data again say from db or xml file or whatever datastore
you use
myInt = myclass.mymethodcall();
}

you can still keep the same layout. as the page using user controls.
say you have your top menu / left hand menu.
copy the controls from that page and put it in a user control.
now in your main page. say use a table set the column and drop the user
control.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
Mike said:
Hi Dave,

Thanks for the explanation.

What if I would store the information in the Application object and
then
store in the Session object of each page in each frame?
Unfortunately, I cannot change the page layout, so I need to stick to
frames.

Thanks.
Mike



:

The problem is simple each frame acts as a instance of browser so
instead
of
sharing the session there might be instances where it sort of gets
messed
up.
Avoid using frames if possible. User controls are a better approach to
the
solution

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)

Hi,

I am developing an application with framesets (header, left
navigation,
and
content). Each frameset loads an ".aspx" page, and in one of these
pages,
I
store some information in the Session object, as follows:

...
Session["ABC"] = false;
...

When the page has finished loading, I click on a link button that
opens
a
Modal window, in which I am trying to access the Session information
stored
before. However, this does not always work. Sometimes, the Session
object
is
empty and the information not available. I am not using Output
caching.

Do you know what the problem could be?

Thanks.
Mike
 
G

Guest

Ok. Thanks.


Hermit Dave said:
not always... its a client side thing.
if done in a proper way they should and would share the same session cookie
but you could have instances where it all goes horribly wrong and each might
have its own session.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
Mike said:
I see what you mean.

Just an additional question. Is the Session object stored for each pages?
So, in my case, each of the ".aspx" pages in each frame could contain a
different Session object. Is that correct?

Thanks.
Mike



Hermit Dave said:
was i would suggest is that if its common data to be used between number
of
users only then consider application / cache.
Infact use Cache object instead of using Application object.
Also put checks in your code before you access session variables

int myInt;
if(Session("variable") != null)
{
// then read it
myInt = (int)Session("variable");
}
else
{
// fetch the data again say from db or xml file or whatever datastore
you use
myInt = myclass.mymethodcall();
}

you can still keep the same layout. as the page using user controls.
say you have your top menu / left hand menu.
copy the controls from that page and put it in a user control.
now in your main page. say use a table set the column and drop the user
control.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)

Hi Dave,

Thanks for the explanation.

What if I would store the information in the Application object and
then
store in the Session object of each page in each frame?
Unfortunately, I cannot change the page layout, so I need to stick to
frames.

Thanks.
Mike



:

The problem is simple each frame acts as a instance of browser so
instead
of
sharing the session there might be instances where it sort of gets
messed
up.
Avoid using frames if possible. User controls are a better approach to
the
solution

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)

Hi,

I am developing an application with framesets (header, left
navigation,
and
content). Each frameset loads an ".aspx" page, and in one of these
pages,
I
store some information in the Session object, as follows:

...
Session["ABC"] = false;
...

When the page has finished loading, I click on a link button that
opens
a
Modal window, in which I am trying to access the Session information
stored
before. However, this does not always work. Sometimes, the Session
object
is
empty and the information not available. I am not using Output
caching.

Do you know what the problem could be?

Thanks.
Mike
 
R

Raymond Lewallen

Mike,

How are you storing your session information? In process, session state
server or Sql Server? I used to have similar problems, but switched to Sql
Server to manage state and don't have issues anymore.
 

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

Top