Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Page doesn't refresh after redirect.

Reply
Thread Tools

Page doesn't refresh after redirect.

 
 
seanmatthewwalsh@hotmail.com
Guest
Posts: n/a
 
      05-12-2008
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
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      05-12-2008
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


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
seanmatthewwalsh@gmail.com
Guest
Posts: n/a
 
      05-12-2008
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"
<(E-Mail Removed)> wrote:
> 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
>
> <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > 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 -

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      05-12-2008
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


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
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"
<(E-Mail Removed)> wrote:
> 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
>
> <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > 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 -



 
Reply With Quote
 
Stan
Guest
Posts: n/a
 
      05-12-2008
On 12 May, 15:37, (E-Mail Removed) 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.

 
Reply With Quote
 
seanmatthewwalsh@gmail.com
Guest
Posts: n/a
 
      05-12-2008
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 <(E-Mail Removed)> wrote:
> On 12 May, 15:37, (E-Mail Removed) 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 -


 
Reply With Quote
 
seanmatthewwalsh@gmail.com
Guest
Posts: n/a
 
      05-12-2008
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, (E-Mail Removed) 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 <(E-Mail Removed)> wrote:
>
>
>
> > On 12 May, 15:37, (E-Mail Removed) 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 -


 
Reply With Quote
 
seanmatthewwalsh@gmail.com
Guest
Posts: n/a
 
      05-12-2008
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, (E-Mail Removed) 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, (E-Mail Removed) 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 <(E-Mail Removed)> wrote:

>
> > > On 12 May, 15:37, (E-Mail Removed) 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 -


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to refresh page after calling showModalDialog teddysnips@hotmail.com ASP .Net 1 06-01-2007 01:14 PM
How to perform page refresh after HttpResponse.BinaryWrite webbertsolutions@newsgroups.nospam ASP .Net 1 02-16-2005 09:11 PM
Re: Page does not refresh after submitting form Mike Szanto ASP .Net 1 02-04-2005 06:17 PM
How do i refresh a datagrid from a pop up window without having to refresh the whole page? Pkenty ASP .Net Web Controls 0 05-28-2004 07:06 AM
Page Scrolling After Refresh Olivier ASP .Net 3 01-19-2004 03:59 PM



Advertisments