473,473 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to make the page expire....

I am using .Net 1.1.
How to expire an .aspx page? I think I have to use HttpCachePolicy class for
this. But not sure how to use and where to this code to work. Is it in
Page_load event.
Thanks
Veer
Nov 18 '05 #1
13 2279
Response.Expires = 0;

Gets or sets the number of minutes before a page cached on a browser
expires. If the user returns to the same page before it expires, the
cached version is displayed.

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net
On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com>
wrote:
I am using .Net 1.1.
How to expire an .aspx page? I think I have to use HttpCachePolicy class for
this. But not sure how to use and where to this code to work. Is it in
Page_load event.
Thanks
Veer


Nov 18 '05 #2
Should I write this code in Load_Page event ?
Veer
"Bobby Ryzhy" <br****@hotmail.com> wrote in message
news:lb********************************@4ax.com...
Response.Expires = 0;

Gets or sets the number of minutes before a page cached on a browser
expires. If the user returns to the same page before it expires, the
cached version is displayed.

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net
On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com>
wrote:
I am using .Net 1.1.
How to expire an .aspx page? I think I have to use HttpCachePolicy class forthis. But not sure how to use and where to this code to work. Is it in
Page_load event.
Thanks
Veer

Nov 18 '05 #3
Yes that's a reasonable place for it.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Should I write this code in Load_Page event ?
Veer
"Bobby Ryzhy" <br****@hotmail.com> wrote in message
news:lb********************************@4ax.com...
Response.Expires = 0;

Gets or sets the number of minutes before a page cached on a browser
expires. If the user returns to the same page before it expires, the
cached version is displayed.

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net
On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com>
wrote:
I am using .Net 1.1.
How to expire an .aspx page? I think I have to use HttpCachePolicy
class
forthis. But not sure how to use and where to this code to work. Is it in
Page_load event.
Thanks
Veer


Nov 18 '05 #4
I have kept the code inside the Page_load event.
Here is my statement Response.Expires = 0
If I clcik on browser back button, still the page seems to be working and
not getting expired.
Veer
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
Yes that's a reasonable place for it.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Should I write this code in Load_Page event ?
Veer
"Bobby Ryzhy" <br****@hotmail.com> wrote in message
news:lb********************************@4ax.com...
Response.Expires = 0;

Gets or sets the number of minutes before a page cached on a browser
expires. If the user returns to the same page before it expires, the
cached version is displayed.

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net
On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com>
wrote:

>I am using .Net 1.1.
>How to expire an .aspx page? I think I have to use HttpCachePolicy

class
for
>this. But not sure how to use and where to this code to work. Is it in >Page_load event.
>Thanks
>Veer
>



Nov 18 '05 #5
Perhaps the page is being cached somewhere.

To avoid that, try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have kept the code inside the Page_load event.
Here is my statement Response.Expires = 0
If I clcik on browser back button, still the page seems to be working and
not getting expired.
Veer
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
Yes that's a reasonable place for it.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Should I write this code in Load_Page event ?
Veer
"Bobby Ryzhy" <br****@hotmail.com> wrote in message
news:lb********************************@4ax.com...
> Response.Expires = 0;
>
> Gets or sets the number of minutes before a page cached on a browser
> expires. If the user returns to the same page before it expires, the
> cached version is displayed.
>
> Bobby Ryzhy
> bobby@ name of domain below
> http://www.weekendtech.net
>
>
> On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com>
> wrote:
>
> >I am using .Net 1.1.
> >How to expire an .aspx page? I think I have to use HttpCachePolicy

class
for
> >this. But not sure how to use and where to this code to work. Is it in > >Page_load event.
> >Thanks
> >Veer
> >
>



Nov 18 '05 #6
Stacy,
I have created a brand new web application with two web forms and tried with
the below code but no luck.
I really don't know why it is not workling. I presume any one can gerenate
this error.
Veer

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
Perhaps the page is being cached somewhere.

To avoid that, try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have kept the code inside the Page_load event.
Here is my statement Response.Expires = 0
If I clcik on browser back button, still the page seems to be working and not getting expired.
Veer
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
Yes that's a reasonable place for it.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> Should I write this code in Load_Page event ?
> Veer
>
>
> "Bobby Ryzhy" <br****@hotmail.com> wrote in message
> news:lb********************************@4ax.com...
> > Response.Expires = 0;
> >
> > Gets or sets the number of minutes before a page cached on a browser > > expires. If the user returns to the same page before it expires, the > > cached version is displayed.
> >
> > Bobby Ryzhy
> > bobby@ name of domain below
> > http://www.weekendtech.net
> >
> >
> > On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com> > > wrote:
> >
> > >I am using .Net 1.1.
> > >How to expire an .aspx page? I think I have to use HttpCachePolicy class
> for
> > >this. But not sure how to use and where to this code to work. Is
it in
> > >Page_load event.
> > >Thanks
> > >Veer
> > >
> >
>
>



Nov 18 '05 #7
Is it possible that a fresh version of your page is being requested, and
that there is no caching of any kind going on?
Exactly what is the behavior you expect that you are not seeing?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
Stacy,
I have created a brand new web application with two web forms and tried with the below code but no luck.
I really don't know why it is not workling. I presume any one can gerenate
this error.
Veer

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
Perhaps the page is being cached somewhere.

To avoid that, try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have kept the code inside the Page_load event.
Here is my statement Response.Expires = 0
If I clcik on browser back button, still the page seems to be working and not getting expired.
Veer
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
> Yes that's a reasonable place for it.
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
>
> "Veeresh" <Ve******@hotmail.com> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
> > Should I write this code in Load_Page event ?
> > Veer
> >
> >
> > "Bobby Ryzhy" <br****@hotmail.com> wrote in message
> > news:lb********************************@4ax.com...
> > > Response.Expires = 0;
> > >
> > > Gets or sets the number of minutes before a page cached on a browser > > > expires. If the user returns to the same page before it expires, the > > > cached version is displayed.
> > >
> > > Bobby Ryzhy
> > > bobby@ name of domain below
> > > http://www.weekendtech.net
> > >
> > >
> > > On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com> > > > wrote:
> > >
> > > >I am using .Net 1.1.
> > > >How to expire an .aspx page? I think I have to use HttpCachePolicy > class
> > for
> > > >this. But not sure how to use and where to this code to work.
Is
it in
> > > >Page_load event.
> > > >Thanks
> > > >Veer
> > > >
> > >
> >
> >
>
>



Nov 18 '05 #8
I have two web forms(WebForm1.aspx and WebForm2.aspx).
WebForm1.aspx is the stating page.
I have a button called Button1 and has clicked event statments as follows.
Response.Redirect("WebForm2.aspx").
I have in the following code in the Page_load event of WebForm1.aspx
Response.Expires = -1

Response.Cache.SetNoStore()

Response.AppendHeader("Pragma", "no-cache")

What I am expecting is:
1.User clicks on Button1 on WebForm1.aspx.
2. Take the user to WebForm2.aspx
3.If user clciks on browser back button, I want to tell the user that page
WebForm1.aspx is already expired.

I am using .Net 1.1 and IE. 6.0 and IE has the following settings.
Check for newer versions of stored pages: Every visit to the page
Ultimately I want to make sure that user cannot go back to login screen
after successfull login.
Thanks for your all replies.
Veer


"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:e5*************@TK2MSFTNGP11.phx.gbl...
Is it possible that a fresh version of your page is being requested, and
that there is no caching of any kind going on?
Exactly what is the behavior you expect that you are not seeing?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
Stacy,
I have created a brand new web application with two web forms and tried

with
the below code but no luck.
I really don't know why it is not workling. I presume any one can gerenate this error.
Veer

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
Perhaps the page is being cached somewhere.

To avoid that, try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> I have kept the code inside the Page_load event.
> Here is my statement Response.Expires = 0
> If I clcik on browser back button, still the page seems to be
working and
> not getting expired.
> Veer
>
>
> "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
> news:uP**************@TK2MSFTNGP10.phx.gbl...
> > Yes that's a reasonable place for it.
> >
> > --
> > I hope this helps,
> > Steve C. Orr, MCSD, MVP
> > http://Steve.Orr.net
> >
> >
> > "Veeresh" <Ve******@hotmail.com> wrote in message
> > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > Should I write this code in Load_Page event ?
> > > Veer
> > >
> > >
> > > "Bobby Ryzhy" <br****@hotmail.com> wrote in message
> > > news:lb********************************@4ax.com...
> > > > Response.Expires = 0;
> > > >
> > > > Gets or sets the number of minutes before a page cached on a

browser
> > > > expires. If the user returns to the same page before it
expires, the
> > > > cached version is displayed.
> > > >
> > > > Bobby Ryzhy
> > > > bobby@ name of domain below
> > > > http://www.weekendtech.net
> > > >
> > > >
> > > > On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh"

<Ve******@hotmail.com>
> > > > wrote:
> > > >
> > > > >I am using .Net 1.1.
> > > > >How to expire an .aspx page? I think I have to use

HttpCachePolicy
> > class
> > > for
> > > > >this. But not sure how to use and where to this code to work.

Is
it
> in
> > > > >Page_load event.
> > > > >Thanks
> > > > >Veer
> > > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #9
Put some code into your login screen for this.
I assume you're setting a UserID or something like that on your login page
after a successful login.
So in your login screen's Page_Load event you can do something like this:

'If the user is already logged in, take them elsewhere
If Not Session("UserID") Is Nothing Then
Response.Redirect("ErrorPage.aspx")
End If

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
I have two web forms(WebForm1.aspx and WebForm2.aspx).
WebForm1.aspx is the stating page.
I have a button called Button1 and has clicked event statments as follows.
Response.Redirect("WebForm2.aspx").
I have in the following code in the Page_load event of WebForm1.aspx
Response.Expires = -1

Response.Cache.SetNoStore()

Response.AppendHeader("Pragma", "no-cache")

What I am expecting is:
1.User clicks on Button1 on WebForm1.aspx.
2. Take the user to WebForm2.aspx
3.If user clciks on browser back button, I want to tell the user that page
WebForm1.aspx is already expired.

I am using .Net 1.1 and IE. 6.0 and IE has the following settings.
Check for newer versions of stored pages: Every visit to the page
Ultimately I want to make sure that user cannot go back to login screen
after successfull login.
Thanks for your all replies.
Veer


"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:e5*************@TK2MSFTNGP11.phx.gbl...
Is it possible that a fresh version of your page is being requested, and
that there is no caching of any kind going on?
Exactly what is the behavior you expect that you are not seeing?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
Stacy,
I have created a brand new web application with two web forms and
tried
with
the below code but no luck.
I really don't know why it is not workling. I presume any one can gerenate this error.
Veer

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
> Perhaps the page is being cached somewhere.
>
> To avoid that, try this code:
>
> Response.Expires = 0
> Response.Cache.SetNoStore()
> Response.AppendHeader("Pragma", "no-cache")
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
>
> "Veeresh" <Ve******@hotmail.com> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
> > I have kept the code inside the Page_load event.
> > Here is my statement Response.Expires = 0
> > If I clcik on browser back button, still the page seems to be working and
> > not getting expired.
> > Veer
> >
> >
> > "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
> > news:uP**************@TK2MSFTNGP10.phx.gbl...
> > > Yes that's a reasonable place for it.
> > >
> > > --
> > > I hope this helps,
> > > Steve C. Orr, MCSD, MVP
> > > http://Steve.Orr.net
> > >
> > >
> > > "Veeresh" <Ve******@hotmail.com> wrote in message
> > > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > > Should I write this code in Load_Page event ?
> > > > Veer
> > > >
> > > >
> > > > "Bobby Ryzhy" <br****@hotmail.com> wrote in message
> > > > news:lb********************************@4ax.com...
> > > > > Response.Expires = 0;
> > > > >
> > > > > Gets or sets the number of minutes before a page cached on a
browser
> > > > > expires. If the user returns to the same page before it expires, the
> > > > > cached version is displayed.
> > > > >
> > > > > Bobby Ryzhy
> > > > > bobby@ name of domain below
> > > > > http://www.weekendtech.net
> > > > >
> > > > >
> > > > > On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh"
<Ve******@hotmail.com>
> > > > > wrote:
> > > > >
> > > > > >I am using .Net 1.1.
> > > > > >How to expire an .aspx page? I think I have to use
HttpCachePolicy
> > > class
> > > > for
> > > > > >this. But not sure how to use and where to this code to

work. Is
it
> > in
> > > > > >Page_load event.
> > > > > >Thanks
> > > > > >Veer
> > > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #10
Steve,
I am thankfull to you for answering my questions.
Page_Load event is not getting called when the user clicks on browser back
button. So the logic below is not working for me. IS there anyway when the
user runs my application I can totally take out this browser navaigational
buttons. This back button is creating problem in other part of the
application too.
Veer.

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:#6**************@TK2MSFTNGP10.phx.gbl...
Put some code into your login screen for this.
I assume you're setting a UserID or something like that on your login page
after a successful login.
So in your login screen's Page_Load event you can do something like this:

'If the user is already logged in, take them elsewhere
If Not Session("UserID") Is Nothing Then
Response.Redirect("ErrorPage.aspx")
End If

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
I have two web forms(WebForm1.aspx and WebForm2.aspx).
WebForm1.aspx is the stating page.
I have a button called Button1 and has clicked event statments as follows.
Response.Redirect("WebForm2.aspx").
I have in the following code in the Page_load event of WebForm1.aspx
Response.Expires = -1

Response.Cache.SetNoStore()

Response.AppendHeader("Pragma", "no-cache")

What I am expecting is:
1.User clicks on Button1 on WebForm1.aspx.
2. Take the user to WebForm2.aspx
3.If user clciks on browser back button, I want to tell the user that page WebForm1.aspx is already expired.

I am using .Net 1.1 and IE. 6.0 and IE has the following settings.
Check for newer versions of stored pages: Every visit to the page
Ultimately I want to make sure that user cannot go back to login screen
after successfull login.
Thanks for your all replies.
Veer


"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:e5*************@TK2MSFTNGP11.phx.gbl...
Is it possible that a fresh version of your page is being requested, and that there is no caching of any kind going on?
Exactly what is the behavior you expect that you are not seeing?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
> Stacy,
> I have created a brand new web application with two web forms and

tried with
> the below code but no luck.
> I really don't know why it is not workling. I presume any one can

gerenate
> this error.
> Veer
>
>
>
> "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
> news:eY**************@TK2MSFTNGP12.phx.gbl...
> > Perhaps the page is being cached somewhere.
> >
> > To avoid that, try this code:
> >
> > Response.Expires = 0
> > Response.Cache.SetNoStore()
> > Response.AppendHeader("Pragma", "no-cache")
> >
> > --
> > I hope this helps,
> > Steve C. Orr, MCSD, MVP
> > http://Steve.Orr.net
> >
> >
> > "Veeresh" <Ve******@hotmail.com> wrote in message
> > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > I have kept the code inside the Page_load event.
> > > Here is my statement Response.Expires = 0
> > > If I clcik on browser back button, still the page seems to be

working
> and
> > > not getting expired.
> > > Veer
> > >
> > >
> > > "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
> > > news:uP**************@TK2MSFTNGP10.phx.gbl...
> > > > Yes that's a reasonable place for it.
> > > >
> > > > --
> > > > I hope this helps,
> > > > Steve C. Orr, MCSD, MVP
> > > > http://Steve.Orr.net
> > > >
> > > >
> > > > "Veeresh" <Ve******@hotmail.com> wrote in message
> > > > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > > > Should I write this code in Load_Page event ?
> > > > > Veer
> > > > >
> > > > >
> > > > > "Bobby Ryzhy" <br****@hotmail.com> wrote in message
> > > > > news:lb********************************@4ax.com...
> > > > > > Response.Expires = 0;
> > > > > >
> > > > > > Gets or sets the number of minutes before a page cached on a > browser
> > > > > > expires. If the user returns to the same page before it

expires,
> the
> > > > > > cached version is displayed.
> > > > > >
> > > > > > Bobby Ryzhy
> > > > > > bobby@ name of domain below
> > > > > > http://www.weekendtech.net
> > > > > >
> > > > > >
> > > > > > On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh"
> <Ve******@hotmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > >I am using .Net 1.1.
> > > > > > >How to expire an .aspx page? I think I have to use
> HttpCachePolicy
> > > > class
> > > > > for
> > > > > > >this. But not sure how to use and where to this code to work. Is
> it
> > > in
> > > > > > >Page_load event.
> > > > > > >Thanks
> > > > > > >Veer
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #11
Steve,
The following code worked for me.

Response.Cache.SetExpires(DateTime.Now.AddSeconds( 0)) '1

Response.Cache.SetCacheability(HttpCacheability.No Cache) '2

Response.Cache.SetValidUntilExpires(False) '3

Response.Cache.VaryByParams("Category") = True '4

Really don't know how it is working. Really don't know the significance of
line 4. If I comment the line 4, the entire logic does not work.

Veer



"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
Perhaps the page is being cached somewhere.

To avoid that, try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have kept the code inside the Page_load event.
Here is my statement Response.Expires = 0
If I clcik on browser back button, still the page seems to be working and not getting expired.
Veer
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
Yes that's a reasonable place for it.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> Should I write this code in Load_Page event ?
> Veer
>
>
> "Bobby Ryzhy" <br****@hotmail.com> wrote in message
> news:lb********************************@4ax.com...
> > Response.Expires = 0;
> >
> > Gets or sets the number of minutes before a page cached on a browser > > expires. If the user returns to the same page before it expires, the > > cached version is displayed.
> >
> > Bobby Ryzhy
> > bobby@ name of domain below
> > http://www.weekendtech.net
> >
> >
> > On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com> > > wrote:
> >
> > >I am using .Net 1.1.
> > >How to expire an .aspx page? I think I have to use HttpCachePolicy class
> for
> > >this. But not sure how to use and where to this code to work. Is
it in
> > >Page_load event.
> > >Thanks
> > >Veer
> > >
> >
>
>



Nov 18 '05 #12
It seems to me you were manually caching your page.
I don't know why you were doing that when it seems like your goal was to not
cache the page.
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Steve,
The following code worked for me.

Response.Cache.SetExpires(DateTime.Now.AddSeconds( 0)) '1

Response.Cache.SetCacheability(HttpCacheability.No Cache) '2

Response.Cache.SetValidUntilExpires(False) '3

Response.Cache.VaryByParams("Category") = True '4

Really don't know how it is working. Really don't know the significance of line 4. If I comment the line 4, the entire logic does not work.

Veer



"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
Perhaps the page is being cached somewhere.

To avoid that, try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have kept the code inside the Page_load event.
Here is my statement Response.Expires = 0
If I clcik on browser back button, still the page seems to be working and not getting expired.
Veer
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
> Yes that's a reasonable place for it.
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
>
> "Veeresh" <Ve******@hotmail.com> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
> > Should I write this code in Load_Page event ?
> > Veer
> >
> >
> > "Bobby Ryzhy" <br****@hotmail.com> wrote in message
> > news:lb********************************@4ax.com...
> > > Response.Expires = 0;
> > >
> > > Gets or sets the number of minutes before a page cached on a browser > > > expires. If the user returns to the same page before it expires, the > > > cached version is displayed.
> > >
> > > Bobby Ryzhy
> > > bobby@ name of domain below
> > > http://www.weekendtech.net
> > >
> > >
> > > On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh" <Ve******@hotmail.com> > > > wrote:
> > >
> > > >I am using .Net 1.1.
> > > >How to expire an .aspx page? I think I have to use HttpCachePolicy > class
> > for
> > > >this. But not sure how to use and where to this code to work.
Is
it in
> > > >Page_load event.
> > > >Thanks
> > > >Veer
> > > >
> > >
> >
> >
>
>



Nov 18 '05 #13
Now I have used only one statement as follows.
Response.Cache.SetCacheability(HttpCacheability.No Cache)
The above code is forcing the Page_Load event to trigger even when the user
clicks on browser back button. Once I am sure of triggering this event all
the time I can always check whether user already logged in or not using the
following code.

If Not Session("MyVariableName") Is Nothing Then

'User already logged in to the system

Response.Redirect("myNextPage.aspx")

End If

Thanks for your all answers.

Hopefully all these theory is good for production environment!!!
Veer


"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...
It seems to me you were manually caching your page.
I don't know why you were doing that when it seems like your goal was to not cache the page.
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Steve,
The following code worked for me.

Response.Cache.SetExpires(DateTime.Now.AddSeconds( 0)) '1

Response.Cache.SetCacheability(HttpCacheability.No Cache) '2

Response.Cache.SetValidUntilExpires(False) '3

Response.Cache.VaryByParams("Category") = True '4

Really don't know how it is working. Really don't know the significance

of
line 4. If I comment the line 4, the entire logic does not work.

Veer



"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
Perhaps the page is being cached somewhere.

To avoid that, try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Veeresh" <Ve******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> I have kept the code inside the Page_load event.
> Here is my statement Response.Expires = 0
> If I clcik on browser back button, still the page seems to be
working and
> not getting expired.
> Veer
>
>
> "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
> news:uP**************@TK2MSFTNGP10.phx.gbl...
> > Yes that's a reasonable place for it.
> >
> > --
> > I hope this helps,
> > Steve C. Orr, MCSD, MVP
> > http://Steve.Orr.net
> >
> >
> > "Veeresh" <Ve******@hotmail.com> wrote in message
> > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > Should I write this code in Load_Page event ?
> > > Veer
> > >
> > >
> > > "Bobby Ryzhy" <br****@hotmail.com> wrote in message
> > > news:lb********************************@4ax.com...
> > > > Response.Expires = 0;
> > > >
> > > > Gets or sets the number of minutes before a page cached on a

browser
> > > > expires. If the user returns to the same page before it
expires, the
> > > > cached version is displayed.
> > > >
> > > > Bobby Ryzhy
> > > > bobby@ name of domain below
> > > > http://www.weekendtech.net
> > > >
> > > >
> > > > On Wed, 7 Jul 2004 12:11:00 -0700, "Veeresh"

<Ve******@hotmail.com>
> > > > wrote:
> > > >
> > > > >I am using .Net 1.1.
> > > > >How to expire an .aspx page? I think I have to use

HttpCachePolicy
> > class
> > > for
> > > > >this. But not sure how to use and where to this code to work.

Is
it
> in
> > > > >Page_load event.
> > > > >Thanks
> > > > >Veer
> > > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #14

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

Similar topics

6
by: gsb | last post by:
I trying to use sessions to save a user name/id after login. If the user leaves the site and comes back, how do I force a new session and login?
31
by: Bruce W...1 | last post by:
This is a best practices question. For a website where PHP is used, does it make sense to have both .htm and .php files? In other words, for pages that have no active content there's no point...
4
by: TCORDON | last post by:
How can I expire a page so if a user click back for example the page shows message "This Page has expired" or better yet a peronalized "Page expired" page. TIA!
1
by: Laphan | last post by:
Hi All I've created an admin side for my ASP site and I use session vars to provide page security. Just as a bit of advice, I want to know if I should expire each admin page so that others...
1
by: umamy | last post by:
Hi, I am writing code to do the followin: - user clicks a link - the page reloads and sets a cookie with a js function in the header. The function reloads the same page with the cookie set and...
0
by: Charles Mifsud | last post by:
Hi, We have an ASP.NET 2.0 web page with user authentication. We have a page which contains a Multiview with a number of different views. Each view represents one step in a whole process. The...
3
by: bbgraph | last post by:
Does anyone have a suggestion for doing this with a date function rather than the typical content=(number of seconds) function? I have an events page that I'd like to expire on a certain date and,...
0
by: Walter Psaila | last post by:
Hi, We have an ASP.NET 2.0 web page with user authentication. We have a page which contains a Multiview with a number of different views. Each view represents one step in a whole process. The...
3
by: =?Utf-8?B?Vk1J?= | last post by:
How can I expire a page after I click on something that redirects me to another page (either a link or a Submit button)? I load the page to be expired via https. I've tried several options I found...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.