Ask a Question related to ASP.NET General, Design and Development.
-
Jeff Trotman #1
Re: Session Object Craziness
I can't find anything technically wrong with what you are describing.
This might just be a nit-picky detail, but - you said that the Session
Object isn't created the first time
and is created on the refresh. The fact that TestCache.aspx displays a
SessionID makes me think
that the Session has been created, but the Session variables just haven't
been written. Without seeing
the code that is actually writing the Session variables, I can't say for
sure, but is it possible that there is some
conditional condition not being satisfied on the initial run (something like
Page.IsPostBack maybe?) that is keeping the session
variables from being written?
Hope this helps.
Jeff Trotman
Westglenn Software
"BGS" <bgs@_NOSPAM_msn.com> wrote in message
news:vhbkkr174akeba@corp.supernews.com...Object> I am having a maddening problem with my web site. The pages generally
> consist of an ASP page, in which there is an inline frame (<iframe>) that
> contains a "slide show" of photos. This inline frame holds an ASPX page,
> with code behind written in C#. The ASPX page relies on the Sessionto> to hold information about which slide show is being viewed and which photo
> is current (so the "next", "previous" and "beginning" buttons will know
> where to go in the sequence).
>
> All of this works perfectly, EXCEPT --
>
> When the user FIRST comes to one of the pages with this inline frame, for
> some reason ASP.NET often does not create the Session Object. The first
> photo loads normally, but when the user clicks on the "next" button, an
> error (usually a Session Out error) occurs (and the user is taken to a
> custom error page). If the user clicks the "Refresh" ("Reload") button on
> the browser, the whole page (including the inline frame) reloads and
> everything then proceeds as desired. In fact, when the user first comesmove> the site, if he/she causes even just the inline frame to reload (by
> right-clicking in the frame), the Session Object will be created and
> everything proceeds as desired.
>
> To see this in action go to: [url]http://www.on-the-matrix.com/africa/index.asp[/url]
> (this is one of many pages with the inline frame slide show).
>
> To confirm that nothing is written to the Session Object, go to:
> [url]http://www.on-the-matrix.com/shared/slidepages/TestCache.aspx[/url] (which lists
> all cookies and the contents of the Session Object).
>
> Further information:
>
> 1. Both the ASP page and the ASPX page that loads in the inline frame
> validate (as per [url]http://validator.w3.org/detailed.html[/url]). The ASP page is
> HTML 4.01 Transitional and the inline ASPX page is XHTML 1.0 Transitional.
>
> 2. There are no JavaScript errors (according to Mozilla's console) as Icomes> through the photos or go from page to page.
>
> 3. In the .NET code behind, it appears as if the Session Object is being
> created. If I test in the code behind to see if Session.Count > 0, itsession> back true. Yet if I go to the test page listed above, Session.Count comes
> back as 0. (By the way, I am using the "InProc" mode of maintainingwas> state with cookies.)
>
> 4. I tried having the ASP page write a cookie (called "StartCookie") the
> first time any page was loaded. The inline ASPX page, through JavaScript,
> read this cookie and if it was the first time the page was loaded,
> JavaScript would cause a "location.reload(true)" that would reload the
> inline ASPX page. This caused some annoying double flashing of the photo,
> but otherwise worked perfectly on my home system and the Session Objectproblem> always created when the ASPX page reloaded. For some reason, however, the
> StartCookie does not get written on my host server.
>
> 5. I can tell from my web stats that it is not just my browsers (IE and
> Mozilla) that are causing the problem. Many visitors experience theall> and it occurs with both IE, Mozilla and recent versions of Netscape (older
> versions get a page without the inline frame).
>
> 6. Both the ASP page and the inline ASPX photo page are created from XML
> data transformed on the server using XSL stylesheets. Again, as noted,creates> the resulting HTML validates.
>
> 7. By the way, I am NOT trying to access a Session Object created in ASP
> with an ASPX page (I already learned that one). The ASPX page bothshow> the Session Object and reads it.
>
> 8. As noted, once users get past the first page, everything works as
> intended. It is only when the user FIRST comes to a page with a slide> that the Session Object is not created.
>
> I hope somebody has some ideas. This is driving me absolutely NUTS!
>
> All help greatly appreciated,
> Bruce
>
>
Jeff Trotman Guest
-
Date Format craziness
I have a DateChooser {dateChooserWeekEnding} When I update the bound DateObject the display changes from MM/DD/YY ( 04/14/2008 ) to ddd, mmm dd... -
adodb.recordset object and the IIS session object
I was looking through the registry of a Windows 2000 Adv. Server I just built and noticed that the adodb.recordset object had been set to "both"... -
Retrieving Object from a Session
When i try to retrieve and object from the $_SESSION variable on a new page the object contains no data. For example <?php /* Get user info ... -
[PHP] Object in session and include
Chris, Your impression is correct, but sounds a little misleading. The include_once will only include the file if it has not yet been included in... -
Object can not be used after a session
Hi I was wondering if anybody has any Ideas about or has experienced this.... I create a new object and then assign it to a session var ... -
BGS #2
Re: Session Object Craziness
Hi Jeff,
Thanks for having a look at my site and your thoughts.
I did review the code again and the mystery only deepens. I do not use (and
therefore do not test for) a PostBack. Thus, whether the page is loaded
initially, or on a browser induced reload, exactly the same code executes.
You are quite right (as TestCache.aspx confirms) that a Session is created
and is assigned a Session ID even though objects saved to the Session Object
do not appear. I can tell from the web stats that even when a user reloads
the initial page and the Session Object then begins to work as intended, the
same Session ID is maintained.
Here's the mysterious part: If the user is coming to a slide show for the
first time (tested by what appears in the query string), the code behind
loads an XSL stylesheet from the disc and places it in the Session Object
(this same stylesheet is used for all photos). After getting the stylesheet
(and manipulating some XML with information about the photo), a separate
method (called RenderPage() ) is called.
The RenderPage() method gets the XSL stylesheet FROM THE SESSION OBJECT and
transforms the XML to display the photo and related information. Thus, the
code behind is able to access the Session Object (or else we would never see
the first photo). After the photo renders, there is nothing in the code
that would wipe away the Session Object. Proof of this comes from the fact
that the very same RenderPage() method is called on a reload (and is also
called to display all subsequent photos in the slide show) and the Session
Object remains intact.
Only when a user FIRST comes to the web site does the Session Object somehow
disappear.
As always, I appreciate any ideas that you, or other members of the group,
may have.
Bruce
"Jeff Trotman" <jtrotman@westglenn.com> wrote in message
news:uXOP2oBTDHA.1320@TK2MSFTNGP12.phx.gbl...like> I can't find anything technically wrong with what you are describing.
>
> This might just be a nit-picky detail, but - you said that the Session
> Object isn't created the first time
> and is created on the refresh. The fact that TestCache.aspx displays a
> SessionID makes me think
> that the Session has been created, but the Session variables just haven't
> been written. Without seeing
> the code that is actually writing the Session variables, I can't say for
> sure, but is it possible that there is some
> conditional condition not being satisfied on the initial run (somethingthat> Page.IsPostBack maybe?) that is keeping the session
> variables from being written?
>
> Hope this helps.
>
> Jeff Trotman
> Westglenn Software
>
>
>
> "BGS" <bgs@_NOSPAM_msn.com> wrote in message
> news:vhbkkr174akeba@corp.supernews.com...> > I am having a maddening problem with my web site. The pages generally
> > consist of an ASP page, in which there is an inline frame (<iframe>)page,> > contains a "slide show" of photos. This inline frame holds an ASPXphoto> Object> > with code behind written in C#. The ASPX page relies on the Session> > to hold information about which slide show is being viewed and whichfor> > is current (so the "next", "previous" and "beginning" buttons will know
> > where to go in the sequence).
> >
> > All of this works perfectly, EXCEPT --
> >
> > When the user FIRST comes to one of the pages with this inline frame,on> > some reason ASP.NET often does not create the Session Object. The first
> > photo loads normally, but when the user clicks on the "next" button, an
> > error (usually a Session Out error) occurs (and the user is taken to a
> > custom error page). If the user clicks the "Refresh" ("Reload") button[url]http://www.on-the-matrix.com/africa/index.asp[/url]> to> > the browser, the whole page (including the inline frame) reloads and
> > everything then proceeds as desired. In fact, when the user first comes> > the site, if he/she causes even just the inline frame to reload (by
> > right-clicking in the frame), the Session Object will be created and
> > everything proceeds as desired.
> >
> > To see this in action go to:lists> > (this is one of many pages with the inline frame slide show).
> >
> > To confirm that nothing is written to the Session Object, go to:
> > [url]http://www.on-the-matrix.com/shared/slidepages/TestCache.aspx[/url] (whichis> > all cookies and the contents of the Session Object).
> >
> > Further information:
> >
> > 1. Both the ASP page and the ASPX page that loads in the inline frame
> > validate (as per [url]http://validator.w3.org/detailed.html[/url]). The ASP pageTransitional.> > HTML 4.01 Transitional and the inline ASPX page is XHTML 1.0comes> move> >
> > 2. There are no JavaScript errors (according to Mozilla's console) as I> comes> > through the photos or go from page to page.
> >
> > 3. In the .NET code behind, it appears as if the Session Object is being
> > created. If I test in the code behind to see if Session.Count > 0, it> > back true. Yet if I go to the test page listed above, Session.CountJavaScript,> session> > back as 0. (By the way, I am using the "InProc" mode of maintaining> > state with cookies.)
> >
> > 4. I tried having the ASP page write a cookie (called "StartCookie") the
> > first time any page was loaded. The inline ASPX page, throughphoto,> > read this cookie and if it was the first time the page was loaded,
> > JavaScript would cause a "location.reload(true)" that would reload the
> > inline ASPX page. This caused some annoying double flashing of thethe> was> > but otherwise worked perfectly on my home system and the Session Object> > always created when the ASPX page reloaded. For some reason, however,(older> problem> > StartCookie does not get written on my host server.
> >
> > 5. I can tell from my web stats that it is not just my browsers (IE and
> > Mozilla) that are causing the problem. Many visitors experience the> > and it occurs with both IE, Mozilla and recent versions of Netscape> all> > versions get a page without the inline frame).
> >
> > 6. Both the ASP page and the inline ASPX photo page are created from XML
> > data transformed on the server using XSL stylesheets. Again, as noted,> creates> > the resulting HTML validates.
> >
> > 7. By the way, I am NOT trying to access a Session Object created in ASP
> > with an ASPX page (I already learned that one). The ASPX page both> show> > the Session Object and reads it.
> >
> > 8. As noted, once users get past the first page, everything works as
> > intended. It is only when the user FIRST comes to a page with a slide>> > that the Session Object is not created.
> >
> > I hope somebody has some ideas. This is driving me absolutely NUTS!
> >
> > All help greatly appreciated,
> > Bruce
> >
> >
>
BGS Guest
-
Jeff Trotman #3
Re: Session Object Craziness
I'm really grasping at straws here, but is it possible that something
about setting the Session object is asynchronous (loading the XSL
or something?) so that the code continues to run and try and read
the object in the session variable but that the operation loading the
file to begin with hasn't completed by the first time but by the time
the refresh happens it has?
Probably a stupid thought, but I can't think of anything else.
"BGS" <bgs@_NOSPAM_msn.com> wrote in message
news:vhdqcq4bkfc7b2@corp.supernews.com...(and> Hi Jeff,
>
> Thanks for having a look at my site and your thoughts.
>
> I did review the code again and the mystery only deepens. I do not useObject> therefore do not test for) a PostBack. Thus, whether the page is loaded
> initially, or on a browser induced reload, exactly the same code executes.
> You are quite right (as TestCache.aspx confirms) that a Session is created
> and is assigned a Session ID even though objects saved to the Sessionreloads> do not appear. I can tell from the web stats that even when a userthe> the initial page and the Session Object then begins to work as intended,stylesheet> same Session ID is maintained.
>
> Here's the mysterious part: If the user is coming to a slide show for the
> first time (tested by what appears in the query string), the code behind
> loads an XSL stylesheet from the disc and places it in the Session Object
> (this same stylesheet is used for all photos). After getting theand> (and manipulating some XML with information about the photo), a separate
> method (called RenderPage() ) is called.
>
> The RenderPage() method gets the XSL stylesheet FROM THE SESSION OBJECTthe> transforms the XML to display the photo and related information. Thus,see> code behind is able to access the Session Object (or else we would neverfact> the first photo). After the photo renders, there is nothing in the code
> that would wipe away the Session Object. Proof of this comes from thesomehow> that the very same RenderPage() method is called on a reload (and is also
> called to display all subsequent photos in the slide show) and the Session
> Object remains intact.
>
> Only when a user FIRST comes to the web site does the Session Objecthaven't> disappear.
>
> As always, I appreciate any ideas that you, or other members of the group,
> may have.
> Bruce
>
>
>
> "Jeff Trotman" <jtrotman@westglenn.com> wrote in message
> news:uXOP2oBTDHA.1320@TK2MSFTNGP12.phx.gbl...> > I can't find anything technically wrong with what you are describing.
> >
> > This might just be a nit-picky detail, but - you said that the Session
> > Object isn't created the first time
> > and is created on the refresh. The fact that TestCache.aspx displays a
> > SessionID makes me think
> > that the Session has been created, but the Session variables justknow> like> > been written. Without seeing
> > the code that is actually writing the Session variables, I can't say for
> > sure, but is it possible that there is some
> > conditional condition not being satisfied on the initial run (something> that> > Page.IsPostBack maybe?) that is keeping the session
> > variables from being written?
> >
> > Hope this helps.
> >
> > Jeff Trotman
> > Westglenn Software
> >
> >
> >
> > "BGS" <bgs@_NOSPAM_msn.com> wrote in message
> > news:vhbkkr174akeba@corp.supernews.com...> > > I am having a maddening problem with my web site. The pages generally
> > > consist of an ASP page, in which there is an inline frame (<iframe>)> page,> > > contains a "slide show" of photos. This inline frame holds an ASPX> photo> > Object> > > with code behind written in C#. The ASPX page relies on the Session> > > to hold information about which slide show is being viewed and which> > > is current (so the "next", "previous" and "beginning" buttons willfirst> for> > > where to go in the sequence).
> > >
> > > All of this works perfectly, EXCEPT --
> > >
> > > When the user FIRST comes to one of the pages with this inline frame,> > > some reason ASP.NET often does not create the Session Object. Thean> > > photo loads normally, but when the user clicks on the "next" button,button> > > error (usually a Session Out error) occurs (and the user is taken to a
> > > custom error page). If the user clicks the "Refresh" ("Reload")comes> on> > > the browser, the whole page (including the inline frame) reloads and
> > > everything then proceeds as desired. In fact, when the user firstI> [url]http://www.on-the-matrix.com/africa/index.asp[/url]> > to> > > the site, if he/she causes even just the inline frame to reload (by
> > > right-clicking in the frame), the Session Object will be created and
> > > everything proceeds as desired.
> > >
> > > To see this in action go to:> lists> > > (this is one of many pages with the inline frame slide show).
> > >
> > > To confirm that nothing is written to the Session Object, go to:
> > > [url]http://www.on-the-matrix.com/shared/slidepages/TestCache.aspx[/url] (which> is> > > all cookies and the contents of the Session Object).
> > >
> > > Further information:
> > >
> > > 1. Both the ASP page and the ASPX page that loads in the inline frame
> > > validate (as per [url]http://validator.w3.org/detailed.html[/url]). The ASP page> Transitional.> > > HTML 4.01 Transitional and the inline ASPX page is XHTML 1.0> > >
> > > 2. There are no JavaScript errors (according to Mozilla's console) asbeing> > move> > > through the photos or go from page to page.
> > >
> > > 3. In the .NET code behind, it appears as if the Session Object isthe> comes> > comes> > > created. If I test in the code behind to see if Session.Count > 0, it> > > back true. Yet if I go to the test page listed above, Session.Count> > session> > > back as 0. (By the way, I am using the "InProc" mode of maintaining> > > state with cookies.)
> > >
> > > 4. I tried having the ASP page write a cookie (called "StartCookie")Object> JavaScript,> > > first time any page was loaded. The inline ASPX page, through> photo,> > > read this cookie and if it was the first time the page was loaded,
> > > JavaScript would cause a "location.reload(true)" that would reload the
> > > inline ASPX page. This caused some annoying double flashing of the> > > but otherwise worked perfectly on my home system and the Sessionand> the> > was> > > always created when the ASPX page reloaded. For some reason, however,> > > StartCookie does not get written on my host server.
> > >
> > > 5. I can tell from my web stats that it is not just my browsers (IEXML> (older> > problem> > > Mozilla) that are causing the problem. Many visitors experience the> > > and it occurs with both IE, Mozilla and recent versions of Netscape> > > versions get a page without the inline frame).
> > >
> > > 6. Both the ASP page and the inline ASPX photo page are created fromnoted,> > > data transformed on the server using XSL stylesheets. Again, asASP> > all> > > the resulting HTML validates.
> > >
> > > 7. By the way, I am NOT trying to access a Session Object created in>> > creates> > > with an ASPX page (I already learned that one). The ASPX page both> > show> > > the Session Object and reads it.
> > >
> > > 8. As noted, once users get past the first page, everything works as
> > > intended. It is only when the user FIRST comes to a page with a slide> >> > > that the Session Object is not created.
> > >
> > > I hope somebody has some ideas. This is driving me absolutely NUTS!
> > >
> > > All help greatly appreciated,
> > > Bruce
> > >
> > >
> >
>
Jeff Trotman Guest



Reply With Quote

