473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Yet another Browser Back question

Hello all:

I note in my application, that when I use
Server.Transfer("somepage.aspx"), when the new page is loaded, and I
click the Back button on the browser, that the previous page, when it
displays, does not appear to have its Page_Load event fire. Neither
does the page which I am leaving have its Page_Unload event fire.

Additionally, there is a listbox on the first page that is populated
based on user-selected values. This listbox, populated at
Server.Transfer time, is blank upon using the browser's Back button.

a) Why does Page_Load not fire upon return to first page when the back
button is pushed?
b) Why is my listbox depopulated?

Thanks much,
zdrakec

Nov 19 '05 #1
7 1938
Hi zdrakec, when you click the back button your browser is displaying locally
cached content and no call to the server is made. You could try to get around
it by setting a caching expiry date (in the past) or forcing _your_ browser
to always load afresh though this will not work for any one who hasnt also
got their browser set the same way HTH jd

"zdrakec" wrote:
Hello all:

I note in my application, that when I use
Server.Transfer("somepage.aspx"), when the new page is loaded, and I
click the Back button on the browser, that the previous page, when it
displays, does not appear to have its Page_Load event fire. Neither
does the page which I am leaving have its Page_Unload event fire.

Additionally, there is a listbox on the first page that is populated
based on user-selected values. This listbox, populated at
Server.Transfer time, is blank upon using the browser's Back button.

a) Why does Page_Load not fire upon return to first page when the back
button is pushed?
b) Why is my listbox depopulated?

Thanks much,
zdrakec

Nov 19 '05 #2
Thank you london, can you describe precisely how one sets the caching
expiration date?

Thanks again,

zdrakec

Nov 19 '05 #3
Hello again, look at the response.cache object in particular:
Response.Cache.SetCacheability(HttpCacheability.*)

Response.Cache.SetExpires(myDate)

HTH jd

"zdrakec" wrote:
Thank you london, can you describe precisely how one sets the caching
expiration date?

Thanks again,

zdrakec

Nov 19 '05 #4
Thanks again london, please forgive me if I'm being a bit dense, but
I'm not sure WHERE to set this...in the second page's load event, or in
the same procedure that executes Server.Transfer?

Cheers,

zdrakec

Nov 19 '05 #5
zdrakec wrote:
Thanks again london, please forgive me if I'm being a bit dense, but
I'm not sure WHERE to set this...in the second page's load event, or
in the same procedure that executes Server.Transfer?

Cheers,

zdrakec


You set it in the page or code-behind class that produces the
HttpResponse, i.e. the actual output received by the client.

Cheers
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #6
Thank you sir!

Nov 19 '05 #7
private void Page_Load(object sender, System.EventArgs e)
{
ExpirePageCache();
//.......rest of the page_load logic....................
}
/// <summary>
/// This function prevent the page being retrieved from broswer cache
/// </summary>
private void ExpirePageCache()
{
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetAllowResponseInBrowserHistory(fa lse);
}
"zdrakec" wrote:
Thanks again london, please forgive me if I'm being a bit dense, but
I'm not sure WHERE to set this...in the second page's load event, or in
the same procedure that executes Server.Transfer?

Cheers,

zdrakec

Nov 19 '05 #8

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

Similar topics

5
by: bbxrider | last post by:
is it possible to mimic/invoke a browsers 'back' function, so the user could click a link/button/etc right on the page instead of being directed to 'use the browsers back button' if not html then...
1
by: Mark Johnson | last post by:
I wonder if anyone has a solution? I wanted to use the web browser control as a 'zoom' box for a smaller textbox. I can format in the control, and save whatever formatting as HTML code back to the...
6
by: David | last post by:
A user logs into a web site. He is then redirected to a web page of his choosing - based on menu options - for example: "WeeklyReport.aspx" is a page the user is currently viewing If the user...
2
by: Dot net work | last post by:
Hello. I have an aspx page that changes an HTML label's text using javascript. After the label's text has been changed in this way, I redirect to another aspx page. If I then use the back...
15
by: tshad | last post by:
I was looking for a way to handle refreshes (user pressed refresh button) and found a piece of code to check if a Web page was refreshed but I can't get it to work. The code is:...
27
by: David Golightly | last post by:
This is just a quick poll for all you web devs out there: What browsers do you test on/are concerned about compatibility with? Obviously, you're going to test on current-generation browsers such...
1
by: joe | last post by:
Logout question I use a session to store the login information, say Session("Login") = success and use page_load to test the session("Login") success or not say If Session("Login") <success...
4
by: Simon | last post by:
Another question. How can I disable the back- and forwardbutton of the browser? Thanks, Simon
1
by: db007 | last post by:
Hi, I have a problem with a current project and the scroll position. I have an AJAX enabled website using Visual Studio 2005 and ASP.Net 2.0. The project also uses masterpages. On the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.