By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,017 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,017 IT Pros & Developers. It's quick & easy.

Page doesn't refresh after redirect.

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.