Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > trouble with caching or caching the trouble

Reply
Thread Tools

trouble with caching or caching the trouble

 
 
Hypo
Guest
Posts: n/a
 
      07-31-2003
Im relatilvly new to a web programming in general, and
here's the situation i have:

I have a default page with dynamic content, and one
button with onclick code something like this:
{
// do some processing...

Serever.Transfer("second_page.aspx");
// or Response.Redirect("second_page.aspx"); same in
// this case
}

On second page i have a new button called "return to
default page" and in his onclick eventhandler

if i say:
- Serever.Transfer("second_page.aspx"); : It return
se me to default page alright, but in the default page
initial state, not the state in which it was just before
user navigate to the second page.
- Response.Redirect("second_page.aspx"); : Same thing
like Server.Transfer(), it transfers me to the default
page initial state.
- Response.Write("<script>history.go(" +
DepthIndex ");</script>"); : It transfers me to a desired
page alright, but instantly returns where it was (on
second page). Is this wired or what?

I suspect problem is in caching, since it is not good
practice to transfer or redirect to default page and
recreate its prevous state, but i cant figure out this
asp.net caching. I have line in my default.aspx page:
<%@ OutputCache Duration="3600" VaryByParam="none" %>
It results is that default page is unable to do any
roundtrips anymore and totaly blocked. If i say:
<%@ OutputCache Duration="3600" VaryByParam="*" %>
It acts like there's no caching, like in firts case.
Im aware that i must save my whole page to a cache just
before i redirect to another page and then, when user
wants to go back to default page, retrive it from cache
and display it ot the user. But, how do i do that?
Cache.Insert("DefaultPage", Self);
and then later:
Self = Cache["DefaultPage"];
Or is this another of my sily ideas?

I hope someone understud what i want, and by the way,
viewstate is turned off globaly if it is relevant.


Any help would be much appreciated.


Cheers,
Hypo - Vedran
 
Reply With Quote
 
 
 
 
Hypo
Guest
Posts: n/a
 
      07-31-2003
i noticed some errors in my first post, heres the corect
text:

>-----Original Message-----

Im relatilvly new to a web programming in general, and
here's the situation i have:

I have a default page with dynamic content, and one
button with onclick code something like this:
{
// do some processing...

Serever.Transfer("second_page.aspx");
// or Response.Redirect("second_page.aspx"); same in
// this case
}

On second page i have a new button called "return to
default page" and in his onclick eventhandler

if i say:
- Serever.Transfer("second_page.aspx"); : It return
se me to default page alright, but in the default page
initial state, not the state in which it was just before
user navigate to the second page.
- Response.Redirect("second_page.aspx"); : Same thing
like Server.Transfer(), it transfers me to the default
page initial state.
- Response.Write(""); : It transfers me to a desired
page alright, but instantly returns where it was (on
second page). Is this wired or what?

I suspect problem is in caching, since it is not good
practice to transfer or redirect to default page and
recreate its prevous state, but i cant figure out this
asp.net caching. I have line in my default.aspx page:
<%@ OutputCache Duration="3600" VaryByParam="none" %>
It results is that default page is unable to do any
roundtrips anymore and totaly blocked. If i say:
<%@ OutputCache Duration="3600" VaryByParam="*" %>
It acts like there's no caching, like in firts case.
Im aware that i must save my whole page to a cache just
before i redirect to another page and then, when user
wants to go back to default page, retrive it from cache
and display it ot the user. But, how do i do that?
Cache.Insert("DefaultPage", Self);
and then later:
Self = Cache["DefaultPage"];
Or is this another of my sily ideas?

I hope someone understud what i want, and by the way,
viewstate is turned off globaly if it is relevant.


Any help would be much appreciated.


Cheers,
Hypo - Vedran
..


 
Reply With Quote
 
 
 
 
Hypo
Guest
Posts: n/a
 
      07-31-2003

>-----Original Message-----
>The third option:
>
> Response.Write("<script>history.go(" +
>DepthIndex ");</script>");


This is third option:
<!--
Response.Write("<script>history.go(" + DepthIndex
+ ");</script>");
-->
I dont know why, but this was recognized as actual
JScript statment inside the original post...

>
>sends the client back to the page where you just

performed the
>server.transfer or response.redirect, so this directive

is just being sent
>back the client again. Maybe try going back two steps

in history.

It doesnt matter how many steps i go back in history,
result is always the same
I, againg suspet that something with caching options is
just not right, but i dont know what.

>You're going to need to do a little more work if you

want the state to be
>saved when the client returns to the page. HTTP is

stateless, so webpages
>will not work this way by default. Cacheing is also not

the solution to
>your problem. You may want to store the contents of

each element in the
>page in the context object, and use server.transfer to

move between to the
>two pages. When you get back to the first page, you can

use the information
>stored in context to re-populate each element on the

page.
>
>-Mark


Recreatin of the page is not good practice, it is much
better to save whole page (in cache?) nad retrive it
later. Anyway, it says that in msdn, but it dont show
how...
 
Reply With Quote
 
Hypo
Guest
Posts: n/a
 
      07-31-2003
Damn, this post engine dosnt show any html elements
inside the post, sory folks...... hello ms, gotta a new
bug ?
 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      07-31-2003
Since you have done nothing to grab the ViewState going to the second page,
the values are cleared out for both Response.Redirect and Server.Transfer.
In the case of the JavaScript, check the condition that causes the page to
transfer. Most likely, you are sending them back to the page, but the
condition forwarding them is still true (not surprising actually, as the
value is likely stored, along with everything else, in viewstate).


Without understanding your application, I cannot comment specifics, but it
is likely you are going about this the wrong way ... from a .NET
perspective. You have options:

1. Grab the ViewState info on the second_page.aspx page and store it for
when a person hits the "go back" condition. You can then reconstitute the
form.

2. Build up forms with multiple views (using, for example, panels). As a
person steps through you show different panels. You can then save the
information for all panels as they are filled out, and go back to any step
without losing the data from other steps. This may be what you are aiming
at.

3. Go to a multi-tiered setup where individual pages make up the views. The
Microsoft UI Process Application Block can be used, if you want a true OO
solution.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

************************************************** **************************
****
Think Outside the Box!
************************************************** **************************
****
"Hypo" <(E-Mail Removed)> wrote in message
news:0b6901c35764$86de0830$(E-Mail Removed)...
> Im relatilvly new to a web programming in general, and
> here's the situation i have:
>
> I have a default page with dynamic content, and one
> button with onclick code something like this:
> {
> // do some processing...
>
> Serever.Transfer("second_page.aspx");
> // or Response.Redirect("second_page.aspx"); same in
> // this case
> }
>
> On second page i have a new button called "return to
> default page" and in his onclick eventhandler
>
> if i say:
> - Serever.Transfer("second_page.aspx"); : It return
> se me to default page alright, but in the default page
> initial state, not the state in which it was just before
> user navigate to the second page.
> - Response.Redirect("second_page.aspx"); : Same thing
> like Server.Transfer(), it transfers me to the default
> page initial state.
> - Response.Write("<script>history.go(" +
> DepthIndex ");</script>"); : It transfers me to a desired
> page alright, but instantly returns where it was (on
> second page). Is this wired or what?
>
> I suspect problem is in caching, since it is not good
> practice to transfer or redirect to default page and
> recreate its prevous state, but i cant figure out this
> asp.net caching. I have line in my default.aspx page:
> <%@ OutputCache Duration="3600" VaryByParam="none" %>
> It results is that default page is unable to do any
> roundtrips anymore and totaly blocked. If i say:
> <%@ OutputCache Duration="3600" VaryByParam="*" %>
> It acts like there's no caching, like in firts case.
> Im aware that i must save my whole page to a cache just
> before i redirect to another page and then, when user
> wants to go back to default page, retrive it from cache
> and display it ot the user. But, how do i do that?
> Cache.Insert("DefaultPage", Self);
> and then later:
> Self = Cache["DefaultPage"];
> Or is this another of my sily ideas?
>
> I hope someone understud what i want, and by the way,
> viewstate is turned off globaly if it is relevant.
>
>
> Any help would be much appreciated.
>
>
> Cheers,
> Hypo - Vedran



 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      07-31-2003
ViewState will still be holding the condition that causes the original
Server.Transfer(), so JavaScript back is not a great option when you are
transfering.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

************************************************** **************************
****
Think Outside the Box!
************************************************** **************************
****
"Mark Heimonen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> The third option:
>
> Response.Write("<script>history.go(" +
> DepthIndex ");</script>");
>
> sends the client back to the page where you just performed the
> server.transfer or response.redirect, so this directive is just being sent
> back the client again. Maybe try going back two steps in history.
>
> You're going to need to do a little more work if you want the state to be
> saved when the client returns to the page. HTTP is stateless, so webpages
> will not work this way by default. Cacheing is also not the solution to
> your problem. You may want to store the contents of each element in the
> page in the context object, and use server.transfer to move between to the
> two pages. When you get back to the first page, you can use the

information
> stored in context to re-populate each element on the page.
>
> -Mark
>
>
> "Hypo" <(E-Mail Removed)> wrote in message
> news:0b6901c35764$86de0830$(E-Mail Removed)...
> > Im relatilvly new to a web programming in general, and
> > here's the situation i have:
> >
> > I have a default page with dynamic content, and one
> > button with onclick code something like this:
> > {
> > // do some processing...
> >
> > Serever.Transfer("second_page.aspx");
> > // or Response.Redirect("second_page.aspx"); same in
> > // this case
> > }
> >
> > On second page i have a new button called "return to
> > default page" and in his onclick eventhandler
> >
> > if i say:
> > - Serever.Transfer("second_page.aspx"); : It return
> > se me to default page alright, but in the default page
> > initial state, not the state in which it was just before
> > user navigate to the second page.
> > - Response.Redirect("second_page.aspx"); : Same thing
> > like Server.Transfer(), it transfers me to the default
> > page initial state.
> > - Response.Write("<script>history.go(" +
> > DepthIndex ");</script>"); : It transfers me to a desired
> > page alright, but instantly returns where it was (on
> > second page). Is this wired or what?
> >
> > I suspect problem is in caching, since it is not good
> > practice to transfer or redirect to default page and
> > recreate its prevous state, but i cant figure out this
> > asp.net caching. I have line in my default.aspx page:
> > <%@ OutputCache Duration="3600" VaryByParam="none" %>
> > It results is that default page is unable to do any
> > roundtrips anymore and totaly blocked. If i say:
> > <%@ OutputCache Duration="3600" VaryByParam="*" %>
> > It acts like there's no caching, like in firts case.
> > Im aware that i must save my whole page to a cache just
> > before i redirect to another page and then, when user
> > wants to go back to default page, retrive it from cache
> > and display it ot the user. But, how do i do that?
> > Cache.Insert("DefaultPage", Self);
> > and then later:
> > Self = Cache["DefaultPage"];
> > Or is this another of my sily ideas?
> >
> > I hope someone understud what i want, and by the way,
> > viewstate is turned off globaly if it is relevant.
> >
> >
> > Any help would be much appreciated.
> >
> >
> > Cheers,
> > Hypo - Vedran

>
>



 
Reply With Quote
 
Hypo
Guest
Posts: n/a
 
      08-01-2003
To bring you little closly my app. :

default.aspx and second_page.aspx consists form datagrids
with custom paging implemented, and navigation buttons.
Viewstate is turned off glabaly for all elements (is this
good?)

Hypothethical situation. User browse on default's page
datagird and lets say go to page 5. Then he hits the
button to transfer himself on second_page.aspx. Do what
he have to to on second_page then he wants to go back on
default to continue browsing, he hits the >> back <<
button on page Response.Redirect("default.apsx") do his
job, he is back on defalt page but not any more on pga 5,
but page 1 (initial page).

How do i avoid this situation, yes i can recreate page
using session variable, but i dont want. It mus be some
better solution.

Thanks for your time, best regards
Vedran
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable page caching without disabling caching of jpegs andstylesheets etc JimLad ASP .Net 3 01-21-2010 10:13 AM
i have no trouble to send , ihave trouble reciving mail --any ideas John Penney Computer Support 4 08-29-2006 08:45 PM
Do anybody experienced caching problems in VS.Net? Dmitry Bond. ASP .Net 2 08-24-2005 07:50 AM
Fragment Caching inside page caching? Troy Simpson ASP .Net 0 01-19-2004 11:57 AM
wccp 3550emi and Cacheflow 800 - transparent caching redirection news.tm.net.my Cisco 0 07-17-2003 02:48 AM



Advertisments