473,385 Members | 1,317 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.

Page doesn't refresh after redirect.

Hi

I have a page (default.aspx) that pulls it's HTML from a database.

I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.

When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.

However, on landing on the default.aspx page, the changes haven't been
applied. Somewhere it has been cached. If I hit refresh or F5, then I
get the updates.

How do I get it to force a refresh / delete the cache?

Thanks
Sean
Jun 27 '08 #1
7 7988
When you redirect to the default page, add to the page url a random query
parameter. This should trick the browser into loading the page from the
server.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<se**************@hotmail.comwrote in message
news:80**********************************@26g2000h sk.googlegroups.com...
Hi

I have a page (default.aspx) that pulls it's HTML from a database.

I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.

When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.

However, on landing on the default.aspx page, the changes haven't been
applied. Somewhere it has been cached. If I hit refresh or F5, then I
get the updates.

How do I get it to force a refresh / delete the cache?

Thanks
Sean

Jun 27 '08 #2
Hi

I tried that, and it didn't work. I used a yyyymmddhhmmss parameter,
and it still kept the original.

Thanks tho. Any other ideas?

Rgds
Sean

On May 12, 4:48*pm, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
When you redirect to the default page, add to the page url a random query
parameter. This should trick the browser into loading the page from the
server.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

<seanmatthewwa...@hotmail.comwrote in message

news:80**********************************@26g2000h sk.googlegroups.com...
Hi
I have a page (default.aspx) that pulls it's HTML from a database.
I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.
When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.
However, on landing on the default.aspx page, the changes haven't been
applied. Somewhere it has been cached. If I hit refresh or F5, then I
get the updates.
How do I get it to force a refresh / delete the cache?
Thanks
Sean- Hide quoted text -

- Show quoted text -
Jun 27 '08 #3
On 12 May, 15:37, seanmatthewwa...@hotmail.com wrote:
Hi

I have a page (default.aspx) that pulls it's HTML from a database.

I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.

When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.

However, on landing on the default.aspx page, the changes haven't been
applied. Somewhere it has been cached. If I hit refresh or F5, then I
get the updates.

How do I get it to force a refresh / delete the cache?

Thanks
Sean
You dont say how the redirection is occuring but to avoid client
caching use Server.Transfer(default.aspx) rather than
Response.Redirect(default.aspx) that way they get the new default.aspx
page directly from the server.

Jun 27 '08 #4
Try to debug it to make sure the datasource gets reloaded from the database.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<se**************@gmail.comwrote in message
news:e9**********************************@i76g2000 hsf.googlegroups.com...
Hi

I tried that, and it didn't work. I used a yyyymmddhhmmss parameter,
and it still kept the original.

Thanks tho. Any other ideas?

Rgds
Sean

On May 12, 4:48 pm, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
When you redirect to the default page, add to the page url a random query
parameter. This should trick the browser into loading the page from the
server.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

<seanmatthewwa...@hotmail.comwrote in message

news:80**********************************@26g2000h sk.googlegroups.com...
Hi
I have a page (default.aspx) that pulls it's HTML from a database.
I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.
When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.
However, on landing on the default.aspx page, the changes haven't been
applied. Somewhere it has been cached. If I hit refresh or F5, then I
get the updates.
How do I get it to force a refresh / delete the cache?
Thanks
Sean- Hide quoted text -

- Show quoted text -

Jun 27 '08 #5
Thanks Stan, but also didn't work when I tried usign the
server.transfer.

I'm finding odd results. I have a line "This is line 1" in the
database. I edit page, and change to "This is line12". The redirect/
transfer takes me back to the page, and "This is line 1" is still
showing.

I click edit again. I change to "This is line 123" and press save. The
redirect/transfer takes me to the page which now shows "This is line
12". In the database, the HTML is stored as "This is line 123"
though.

Must be some caching issue.

I put a breakpoint on the default.aspx file, at the point where the
HTML is pulled from the DB and put in the file. I edit the page, and
change to "This is line 1234", and on the transfer, the breakpoint
stops execution. I check the Immediate window to see what the HTML
from the recordset is, and it's "This is line 1234". I click the
continue button, and the page shows properly as "This is line 1234".
i.e. the debugging process seems to delete/override the cache.

I even tried Response.Expires = -1 and
HttpResponse.RemoveOutputCacheItem("/Default.aspx") to no avail.

Thanks
Sean
On May 12, 5:21*pm, Stan <goo...@philphall.me.ukwrote:
On 12 May, 15:37, seanmatthewwa...@hotmail.com wrote:


Hi
I have a page (default.aspx) that pulls it's HTML from a database.
I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.
When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.
However, on landing on the default.aspx page, the changes haven't been
applied. Somewhere it has been cached. If I hit refresh or F5, then I
get the updates.
How do I get it to force a refresh / delete the cache?
Thanks
Sean

You dont say how the redirection is occuring but to avoid client
caching use Server.Transfer(default.aspx) rather than
Response.Redirect(default.aspx) that way they get the new default.aspx
page directly from the server.- Hide quoted text -

- Show quoted text -
Jun 27 '08 #6
Ok, the latest on this:

I added a breakpoint to the default.aspx page AFTER the page retrieves
the HTML from the database.

I then edited the page through EditPage.aspx and clicked save.

Now, the execution stops only AFTER the database has been accessed,
and it appears the retrieved data from the database is the OLD
version, i.e. it hasn't been updated. But if I open the database and
check, or if I refresh the Default.aspx page, then the HTML in the DB
is clearly the new version.

It appears the access database hasn't written the changed data before
the web server has already requested the page, so the page gets the
old data before it has been overwritten. i.e. it's too quick for
itself, or so it seems.

Is this possible? What's the fix?

Thanks

On May 12, 5:31*pm, seanmatthewwa...@gmail.com wrote:
Thanks Stan, but also didn't work when I tried usign the
server.transfer.

I'm finding odd results. I have a line "This is line 1" in the
database. I edit page, and change to "This is line12". The redirect/
transfer takes me back to the page, and "This is line 1" is still
showing.

I click edit again. I change to "This is line 123" and press save. The
redirect/transfer takes me to the page which now shows "This is line
12". In the database, the HTML is stored as "This is line 123"
though.

Must be some caching issue.

I put a breakpoint on the default.aspx file, at the point where the
HTML is pulled from the DB and put in the file. I edit the page, and
change to "This is line 1234", and on the transfer, the breakpoint
stops execution. I check the Immediate window to see what the HTML
from the recordset is, and it's "This is line 1234". I click the
continue button, and the page shows properly as "This is line 1234".
i.e. the debugging process seems to delete/override the cache.

I even tried Response.Expires = -1 and
HttpResponse.RemoveOutputCacheItem("/Default.aspx") to no avail.

Thanks
Sean

On May 12, 5:21*pm, Stan <goo...@philphall.me.ukwrote:
On 12 May, 15:37, seanmatthewwa...@hotmail.com wrote:
Hi
I have a page (default.aspx) that pulls it's HTML from a database.
I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.
When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.
However, on landing on the default.aspx page, the changes haven't been
applied. Somewhere it has been cached. If I hit refresh or F5, then I
get the updates.
How do I get it to force a refresh / delete the cache?
Thanks
Sean
You dont say how the redirection is occuring but to avoid client
caching use Server.Transfer(default.aspx) rather than
Response.Redirect(default.aspx) that way they get the new default.aspx
page directly from the server.- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
Jun 27 '08 #7
Yay!!

I put the following line before my Response.Redirect:
System.Threading.Thread.Sleep(1000);

That delays execution for a second, and gives the database time to
catch up!

Sorted.

Thanks for your efforts
On May 12, 6:04*pm, seanmatthewwa...@gmail.com wrote:
Ok, the latest on this:

I added a breakpoint to the default.aspx page AFTER the page retrieves
the HTML from the database.

I then edited the page through EditPage.aspx and clicked save.

Now, the execution stops only AFTER the database has been accessed,
and it appears the retrieved data from the database is the OLD
version, i.e. it hasn't been updated. But if I open the database and
check, or if I refresh the Default.aspx page, then the HTML in the DB
is clearly the new version.

It appears the access database hasn't written the changed data before
the web server has already requested the page, so the page gets the
old data before it has been overwritten. i.e. it's too quick for
itself, or so it seems.

Is this possible? What's the fix?

Thanks

On May 12, 5:31*pm, seanmatthewwa...@gmail.com wrote:
Thanks Stan, but also didn't work when I tried usign the
server.transfer.
I'm finding odd results. I have a line "This is line 1" in the
database. I edit page, and change to "This is line12". The redirect/
transfer takes me back to the page, and "This is line 1" is still
showing.
I click edit again. I change to "This is line 123" and press save. The
redirect/transfer takes me to the page which now shows "This is line
12". In the database, the HTML is stored as "This is line 123"
though.
Must be some caching issue.
I put a breakpoint on the default.aspx file, at the point where the
HTML is pulled from the DB and put in the file. I edit the page, and
change to "This is line 1234", and on the transfer, the breakpoint
stops execution. I check the Immediate window to see what the HTML
from the recordset is, and it's "This is line 1234". I click the
continue button, and the page shows properly as "This is line 1234".
i.e. the debugging process seems to delete/override the cache.
I even tried Response.Expires = -1 and
HttpResponse.RemoveOutputCacheItem("/Default.aspx") to no avail.
Thanks
Sean
On May 12, 5:21*pm, Stan <goo...@philphall.me.ukwrote:
On 12 May, 15:37, seanmatthewwa...@hotmail.com wrote:
Hi
I have a page (default.aspx) that pulls it's HTML from a database.
I then have a "content management" page (editpage.aspx) that allows
the user to edit the HTML in the database.
When the user clicks the save button on editpage.aspx, the page
updates the database and then redirects to the default.aspx page.
However, on landing on the default.aspx page, the changes haven't been
applied. Somewhere it has been cached. If I hit refresh or F5, then I
get the updates.
How do I get it to force a refresh / delete the cache?
Thanks
Sean
You dont say how the redirection is occuring but to avoid client
caching use Server.Transfer(default.aspx) rather than
Response.Redirect(default.aspx) that way they get the new default.aspx
page directly from the server.- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
Jun 27 '08 #8

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

Similar topics

6
by: Rick | last post by:
Hi folks, I have a web page I wrote for a class assignment (which I embellished a little) that doesn't seem to work on all browsers, platforms, etc. The problem appears to be that the page...
4
by: Gezzed | last post by:
Hi ! I just installed IIS on my Windows 2000 system. I tried to place a .ASP page on my C:\Inetpub\wwwroot directory, and it seems to work. However, when I change the page content (the code, or...
2
by: John | last post by:
Hi. When I use VB.NET projects, Visual Studio refreshes the display when I correct errors. (i.e. removes the blue and red lines under syntax errors etc.) But when I use C# projects, the display...
8
by: TS | last post by:
Im in a web page and call an asynchronous method in business class. the call back method is in the web page. When page processes, it runs thru code begins invoking the method then the page...
1
by: Nallaperumal | last post by:
I have to make a page stable while refresh the page. Please guide me. The values in the page should not get changed while i refresh the page.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.