472,353 Members | 1,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 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 2791
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...
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...
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...
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...
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...
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...
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...
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...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.