473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Frames and Session?

Okay, so I know I'm doing two evil things: using Frames
and storing stuff in Session. I'm a sinner and I'll
repent after this project, I promise.

But for now, I've got an interesting issue.

In a site's Gobal.asax, I've written the following in
Session_OnStart:

Session.Add("Started",now.toString)

I also have a WebForm named WebForm1.aspx (not feeling
overly creative today) where, in the PageLoad event, I've
added this:

Session.Add("PageLoad",now.toString)

Using Performance Monitor, I've watch the total of active
sessions when browsing WebForm1 .aspx. As expected, I get
use on (additional) session.

This site also has a frameset page in it (frameset1.htm)
and "contains" three webforms: Frame1.aspx, Frame2.aspx
and Frame3.aspx. Each of the /Frame\d.aspx/ files as
statement like the following in its PageLoad
event:

(note that /Frame\d.aspx/ is one of
frame1.aspx...frame3.aspx, I'm just used tro writing
Regular Expressions...)

Session.Add("Frame/\d/",now.toString)

Before browsing Frameset1.htm, I use IIS restart to
abadon and clean out all sessions. But when I browse
Frameset1.htm, I get not one, not two, but three active
sessions. Each of the Frame\d.aspx pages has label
controls that show the SessionID, the global "Started"
and local "Frame/\d/" value.

That begs three questions:
a. Why?
b. If I just want one session for all three frames, what
do I need to do?
c. Is this new behavior 1.1 or does it has it never
worked like I thought it would? (e.g, this is behavior by
design)

FWIW, I've also tried decorating the code
with "SyncBlock"s in the Frame/\d/.aspx pages, but it
doesn't seem to make a difference.

I think I have a partial answer: each frame is getting
its own session ID. I don't want that, I want them all to
have the same one.

BTW, I get the same results with fx1.0, but not with
fx1.2 (Whidbey... heh, something that does work there...)

Thanks,

Kent Tegels
Nov 18 '05 #1
4 2839
Using Frames and Session is not "evil" - it is merely difficult, and
requires a good bit more programming skill to do than to work without either
one. Session State is, in fact, still quite useful, and even necessary from
one time to another. You have just encountered what makes using Frames
difficult. You see, a FrameSet is a container that holds multiple instances
of a browser in a single HTML document. Because each Frame is a separate
instance of the browser, each Frame has its own Session. There is no way to
share the Session between them. In fact, the only communication that can
occur between them is on the client side, via JavaScript and/or hyperlinks.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Kent Tegels" <ke**@troll.tegels.org> wrote in message
news:09****************************@phx.gbl...
Okay, so I know I'm doing two evil things: using Frames
and storing stuff in Session. I'm a sinner and I'll
repent after this project, I promise.

But for now, I've got an interesting issue.

In a site's Gobal.asax, I've written the following in
Session_OnStart:

Session.Add("Started",now.toString)

I also have a WebForm named WebForm1.aspx (not feeling
overly creative today) where, in the PageLoad event, I've
added this:

Session.Add("PageLoad",now.toString)

Using Performance Monitor, I've watch the total of active
sessions when browsing WebForm1 .aspx. As expected, I get
use on (additional) session.

This site also has a frameset page in it (frameset1.htm)
and "contains" three webforms: Frame1.aspx, Frame2.aspx
and Frame3.aspx. Each of the /Frame\d.aspx/ files as
statement like the following in its PageLoad
event:

(note that /Frame\d.aspx/ is one of
frame1.aspx...frame3.aspx, I'm just used tro writing
Regular Expressions...)

Session.Add("Frame/\d/",now.toString)

Before browsing Frameset1.htm, I use IIS restart to
abadon and clean out all sessions. But when I browse
Frameset1.htm, I get not one, not two, but three active
sessions. Each of the Frame\d.aspx pages has label
controls that show the SessionID, the global "Started"
and local "Frame/\d/" value.

That begs three questions:
a. Why?
b. If I just want one session for all three frames, what
do I need to do?
c. Is this new behavior 1.1 or does it has it never
worked like I thought it would? (e.g, this is behavior by
design)

FWIW, I've also tried decorating the code
with "SyncBlock"s in the Frame/\d/.aspx pages, but it
doesn't seem to make a difference.

I think I have a partial answer: each frame is getting
its own session ID. I don't want that, I want them all to
have the same one.

BTW, I get the same results with fx1.0, but not with
fx1.2 (Whidbey... heh, something that does work there...)

Thanks,

Kent Tegels

Nov 18 '05 #2
Kevin,

Thanks for the response. While I think the answer you
gave is correct, I'm getting some very different behavior
that begs a couple of questions.

a. Subsequent testing has shown that this is only a
problem for the first browse after the site has been
compiled. Any subsequent sessions appear to have the same
session IDs and session values for each frame. That would
run counter to the behavior you've described.

b. Why isn't this occuring with Whidbey? Did they change
the Session ID generation mechanism maybe? Is there some
lucky charm in the code that we better not count on?

Since we're fairly early in the process, changing the
site to be unframed isn't that painful to do. I'm more or
less wondering why (techically) we're getting the
experience we are.

If I'm making sense, I'll gladly put the source code
where you can get at it if you like.

Thanks!
kt
Nov 18 '05 #3
You will find that this behavior changes from one browser to another, from
one version of a browser to another, and from one environment to another. As
I never use Frames, I'm afraid you're on your own if you want to pursue this
avenue.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Kent Tegels" <ke**@troll.tegels.org> wrote in message
news:15*****************************@phx.gbl...
Kevin,

Thanks for the response. While I think the answer you
gave is correct, I'm getting some very different behavior
that begs a couple of questions.

a. Subsequent testing has shown that this is only a
problem for the first browse after the site has been
compiled. Any subsequent sessions appear to have the same
session IDs and session values for each frame. That would
run counter to the behavior you've described.

b. Why isn't this occuring with Whidbey? Did they change
the Session ID generation mechanism maybe? Is there some
lucky charm in the code that we better not count on?

Since we're fairly early in the process, changing the
site to be unframed isn't that painful to do. I'm more or
less wondering why (techically) we're getting the
experience we are.

If I'm making sense, I'll gladly put the source code
where you can get at it if you like.

Thanks!
kt

Nov 18 '05 #4
Kevin, I do appreciate your help. I'll continue this thread at:

http://sqljunkies.com/weblog/ktegels/posts/621.aspx

Thanks!
kt
Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave Smithz | last post by:
Hi there, I have implemented a login sequence using session variables for a PHP/MySQL DB which I took over development. I read some books and this NG and it seemed straight forward. However the...
4
by: A Web Master | last post by:
I am designing a site for a client where I have a frameset and 3 frames (all in ASP). I am creating session variables in the frameset that need to be accessed in the frames. It seams that in...
4
by: A Web Master | last post by:
I want to know the best way of passing on variable contents on a site coded in ASP using frameset/frame. Content is used in all frames for stuffs like screen_resolution, language, ... My...
5
by: Filip Matošić | last post by:
I ha a login page which has no frames, and when a user logs in, i set a session variable ( session("userlogged")=true to true, then the page redirects the user to a page with frames(3 frames) in...
2
by: Bonj | last post by:
H I've got the following problem - I need to have an aspx page with two frames, although the question isn't necessarily about the workings of the frames, more session variables... the frames consist...
3
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a...
1
by: SteveComplex | last post by:
I'm currently working on a project developing a web application that makes heavy use of 3rd-party controls, popup windows and frames ( not my design I hasten to add ). Some of the pages make use...
6
by: Doug | last post by:
I'm about to go nuts. I've got a VB.NET web app , utilizing frames(my 1st mistake). One of the frames is hidden and does a behind the scenes refresh, to keep the session alive. This works great...
1
by: my cats, Gag and yak | last post by:
Regarding my previous post and a reply: ++++ Don't use frames - they're not needed in ASP.NET. Or, if you really can't get your head round that and absolutely must use framesets:...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.