browser sometime is very "donkey": just add to "http://yoururl/YouPage.aspx" + "?anyparameter=1"
For example if I'm at page www.mysite.com/mypage.aspx?product=1 you need only to compose a new web url such as www.mysite.com/mypage.aspx?product=1&whateveryouwant=1
The browser look for the "new" address and ignore the cache.
jakein2008
Member
233 Points
379 Posts
How to refresh the page programatically by C# ?
Aug 26, 2008 12:54 AM|LINK
How to refresh the page programatically by C# ? Please give me the sample code.
Thanks.
vinz
All-Star
128483 Points
18150 Posts
MVP
Re: How to refresh the page programatically by C# ?
Aug 26, 2008 02:37 AM|LINK
You can try with Response.Redirect() method at the server side or use Form.Submit at Client side..
For more examples then you can refer to the following link below
http://forums.asp.net/t/1161549.aspx
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
susmitadeb
Participant
1052 Points
184 Posts
Re: How to refresh the page programatically by C# ?
Aug 26, 2008 04:29 AM|LINK
Hey,
You can redirect on the same page using following code :
Response.Redirect(Request.RawUrl);
If you want to do on clientside and not the server,
use javascript:document.location.reload()
or
window.location.href= window.location;
Hope this will work.
navyjax2
Member
88 Points
45 Posts
Re: How to refresh the page programatically by C# ?
Feb 23, 2012 05:00 AM|LINK
Response.Redirect(Request.RawUrl);
Worked for me! Thank you, exactly what I was looking for! Probably not the best way to trigger a postback, but did the refresh I needed it to do :)
Lokko
Member
4 Points
2 Posts
Re: How to refresh the page programatically by C# ?
Oct 19, 2012 12:53 PM|LINK
Hi
Is there a way to force the page reload from server and force bypass the browser's cache ?
kamamusic
Member
17 Points
8 Posts
Re: How to refresh the page programatically by C# ?
Oct 23, 2012 12:58 PM|LINK
Hi Lokko
browser sometime is very "donkey": just add to "http://yoururl/YouPage.aspx" + "?anyparameter=1"
For example if I'm at page www.mysite.com/mypage.aspx?product=1 you need only to compose a new web url such as www.mysite.com/mypage.aspx?product=1&whateveryouwant=1
The browser look for the "new" address and ignore the cache.
Roberto
Lokko
Member
4 Points
2 Posts
Re: How to refresh the page programatically by C# ?
Oct 23, 2012 01:03 PM|LINK
Hi Kamamusic
That's a pleasant workaround, thank you for your idea !
kamamusic
Member
17 Points
8 Posts
Re: How to refresh the page programatically by C# ?
Oct 23, 2012 03:12 PM|LINK
from javascript side:
function RefreshMe()
{
var nuovourl = window.location.href + '';
nuovourl = nuovourl + (nuovourl.indexOf('?') > -1 ? "&refreshme=1" : "?refreshme=1");
window.location.href = nuovourl;
}
Hope this help.