page expiration

Discussion in 'ASP .Net' started by kpg, Jun 17, 2005.

  1. kpg

    kpg Guest

    Hi all, easy question:

    How can I make a page expire immediately?

    I don't want the user to be able to re-visit it.

    Tried <% response.expires = 0 %>, did not work.

    Don't understand how to use the System.Web.HttpCachePolicy

    ???

    Thanks
    kpg
     
    kpg, Jun 17, 2005
    #1
    1. Advertising

  2. kpg

    Kim Quigley Guest

    Setting Response.Expires to 0 just makes it so the browser doesn't cache the
    page, which doesn't sound at all like the solution to your problem.

    Are you saying that if someone sees a certain page, then if they refresh or
    return to it, you want them to see something else or be redirected?


    "kpg" <> wrote in message
    news:%...
    > Hi all, easy question:
    >
    > How can I make a page expire immediately?
    >
    > I don't want the user to be able to re-visit it.
    >
    > Tried <% response.expires = 0 %>, did not work.
    >
    > Don't understand how to use the System.Web.HttpCachePolicy
    >
    > ???
    >
    > Thanks
    > kpg
     
    Kim Quigley, Jun 17, 2005
    #2
    1. Advertising

  3. kpg

    kpg Guest

    > Setting Response.Expires to 0 just makes it so the browser doesn't cache
    > the page, which doesn't sound at all like the solution to your problem.
    >
    > Are you saying that if someone sees a certain page, then if they refresh
    > or return to it, you want them to see something else or be redirected?


    After the user logs on I show a page that displays a list of items
    previously
    saved. When the user picks one I redirect them to a page with the selected
    data loaded to begin processing. If they hit the back button (history) of
    the
    browser and try to revisit the item list page I want to show that it has
    expired.
    There should be no way for them to return to this page unless they logoff
    and then back on.

    If the page were not cached then the request would come to the server
    and I could display a message. My problem is I put a response.expires =0
    and I still got the cached page. Maybe I was using it wrong. I added it to
    the top of the html page before the <head>. I also tried adding a
    response.expires = 0 into the page load event with the same effect (none).

    Hope that clears it up.

    Thanks,
    kpg
     
    kpg, Jun 17, 2005
    #3
  4. kpg

    Guest

    When they visit the page, put a variable on the session to indicate
    that they have vitited. When they come back, the session will have the
    value and you can display an appropriate message.


    sayed
     
    , Jun 17, 2005
    #4
  5. kpg

    Kim Quigley Guest

    The problem with the back button is an age old issue and I'm very interested
    to see if anyone is going to offer you a solution. When a user clicks the
    back button, the page doesn't reload, so no code is executed.


    "kpg" <> wrote in message
    news:e0$...
    >> Setting Response.Expires to 0 just makes it so the browser doesn't cache
    >> the page, which doesn't sound at all like the solution to your problem.
    >>
    >> Are you saying that if someone sees a certain page, then if they refresh
    >> or return to it, you want them to see something else or be redirected?

    >
    > After the user logs on I show a page that displays a list of items
    > previously
    > saved. When the user picks one I redirect them to a page with the
    > selected
    > data loaded to begin processing. If they hit the back button (history) of
    > the
    > browser and try to revisit the item list page I want to show that it has
    > expired.
    > There should be no way for them to return to this page unless they logoff
    > and then back on.
    >
    > If the page were not cached then the request would come to the server
    > and I could display a message. My problem is I put a response.expires =0
    > and I still got the cached page. Maybe I was using it wrong. I added it
    > to
    > the top of the html page before the <head>. I also tried adding a
    > response.expires = 0 into the page load event with the same effect (none).
    >
    > Hope that clears it up.
    >
    > Thanks,
    > kpg
     
    Kim Quigley, Jun 17, 2005
    #5
  6. kpg

    kpg Guest

    OK. Here it is.

    Put this in the page load event: Response.Cache.SetNoStore()

    This prevents the browser from caching the page, which
    means I will always get the hit when the page is reloaded.

    I found this info at:

    http://www.codenotes.com/articles/articleAction.aspx?articleID=1022

    --
    kpg

    "Kim Quigley" <> wrote in message
    news:...
    ># Name resolution details: file://c:\temp\328821.htm (6/17/2005 2:00:56 PM)
    >#
    > The problem with the back button is an age old issue and I'm very
    > interested to see if anyone is going to offer you a solution. When a user
    > clicks the back button, the page doesn't reload, so no code is executed.
    >
    >
    > "kpg" <> wrote in message
    > news:e0$...
    >>> Setting Response.Expires to 0 just makes it so the browser doesn't cache
    >>> the page, which doesn't sound at all like the solution to your problem.
    >>>
    >>> Are you saying that if someone sees a certain page, then if they refresh
    >>> or return to it, you want them to see something else or be redirected?

    >>
    >> After the user logs on I show a page that displays a list of items
    >> previously
    >> saved. When the user picks one I redirect them to a page with the
    >> selected
    >> data loaded to begin processing. If they hit the back button (history)
    >> of the
    >> browser and try to revisit the item list page I want to show that it has
    >> expired.
    >> There should be no way for them to return to this page unless they logoff
    >> and then back on.
    >>
    >> If the page were not cached then the request would come to the server
    >> and I could display a message. My problem is I put a response.expires =0
    >> and I still got the cached page. Maybe I was using it wrong. I added it
    >> to
    >> the top of the html page before the <head>. I also tried adding a
    >> response.expires = 0 into the page load event with the same effect
    >> (none).
    >>
    >> Hope that clears it up.
    >>
    >> Thanks,
    >> kpg

    >
    >
     
    kpg, Jun 17, 2005
    #6
  7. Try this code:
    Response.Expires = 0
    Response.Cache.SetNoStore()
    Response.AppendHeader("Pragma", "no-cache")

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "kpg" <> wrote in message
    news:%...
    > Hi all, easy question:
    >
    > How can I make a page expire immediately?
    >
    > I don't want the user to be able to re-visit it.
    >
    > Tried <% response.expires = 0 %>, did not work.
    >
    > Don't understand how to use the System.Web.HttpCachePolicy
    >
    > ???
    >
    > Thanks
    > kpg
     
    Steve C. Orr [MVP, MCSD], Jun 17, 2005
    #7
  8. kpg

    Joerg Jooss Guest

    kpg wrote:

    > Hi all, easy question:
    >
    > How can I make a page expire immediately?
    >
    > I don't want the user to be able to re-visit it.
    >
    > Tried <% response.expires = 0 %>, did not work.
    >
    > Don't understand how to use the System.Web.HttpCachePolicy


    HttpResponse has a "Cache" property which is a instance if
    HttpCachePolicy. You should set your caching options through this
    object, e.g.

    Response.Cache.SetCacheability(HttpCacheability.NoCache);

    Cheers,
    --
    http://www.joergjooss.de
    mailto:
     
    Joerg Jooss, Jun 18, 2005
    #8
  9. kpg

    Joerg Jooss Guest

    kpg wrote:

    > OK. Here it is.
    >
    > Put this in the page load event: Response.Cache.SetNoStore()
    >
    > This prevents the browser from caching the page, which
    > means I will always get the hit when the page is reloaded.


    Note that there's no guarantee that this works across all browsers.

    Cheers,
    --
    http://www.joergjooss.de
    mailto:
     
    Joerg Jooss, Jun 18, 2005
    #9
  10. add this line to ur html coding
    it will prevent user from hitting the back button of our browser...



    <body onload="history.go(+1)" MS_POSITIONING="GridLayout">


    try it and c whether it has any affect?

    email me at



    kpg wrote:
    >Hi all, easy question:
    >
    >How can I make a page expire immediately?
    >
    >I don't want the user to be able to re-visit it.
    >
    >Tried <% response.expires = 0 %>, did not work.
    >
    >Don't understand how to use the System.Web.HttpCachePolicy
    >
    >???
    >
    >Thanks
    >kpg



    --
    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200507/1
     
    \jason via DotNetMonster.com\, Jul 6, 2005
    #10
  11. add this line to ur html coding
    it will prevent user from hitting the back button of our browser...



    <body onload="history.go(+1)" MS_POSITIONING="GridLayout">


    try it and c whether it has any affect?

    email me at


    Kim Quigley wrote:
    >The problem with the back button is an age old issue and I'm very interested
    >to see if anyone is going to offer you a solution. When a user clicks the
    >back button, the page doesn't reload, so no code is executed.
    >
    >>> Setting Response.Expires to 0 just makes it so the browser doesn't cache
    >>> the page, which doesn't sound at all like the solution to your problem.

    >[quoted text clipped - 24 lines]
    >> Thanks,
    >> kpg



    --
    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200507/1
     
    \jason via DotNetMonster.com\, Jul 6, 2005
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken

    Page expiration

    Ken, Nov 1, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    1,140
    Guest
    Nov 3, 2003
  2. Vijay
    Replies:
    3
    Views:
    1,483
    Saravana [MVP]
    Nov 4, 2003
  3. Josh Anderson - remove Zs to reply

    Page expiration warning on back navigation

    Josh Anderson - remove Zs to reply, Nov 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,349
    Saravana [MVP]
    Nov 19, 2003
  4. naijacoder naijacoder

    Page expiration - Is it with Session.Timeout

    naijacoder naijacoder, Sep 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    443
    Greg Burns
    Sep 9, 2004
  5. Nitin

    Page Expiration

    Nitin, Mar 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,136
    Patrick Olurotimi Ige
    Mar 3, 2005
Loading...

Share This Page