This line of code reads the URL as is, and redirects you to the same page without a new message. Put it at the click of a button, on the code behind.
Response.Redirect(Request.RawUrl);
PS If you just post, the input controls will save their data, so you need to reload the page from the very beginning, with redirection. If you are not redirecting, you need to process the controls and clear them.
In addition, you can avoid the inverse and OnClientClick="return ReloadPage();" to the server and do the same on the client side using javascript calling OnClientClick="return ReloadPage();" with JavaScript code:
function ReloadPage() { top.location.replace( updateURLParameter(document.location.href, "_rnd", Math.random()) ); return false; } // // this function is an improved version of // http://stackoverflow.com/a/10997390/159270 // function updateURLParameter(url, param, paramVal) { var TheAncor = null; var newAdditionalURL = ""; var tempArray = url.split("?"); var baseURL = tempArray[0]; var additionalURL = tempArray[1]; var temp = ""; if (additionalURL) { var tmpAncor = additionalURL.split("#"); var TheParams = tmpAncor[0]; TheAncor = tmpAncor[1]; if(TheAncor) additionalURL = TheParams; tempArray = additionalURL.split("&"); for (i=0; i<tempArray.length; i++) { if(tempArray[i].split('=')[0] != param) { newAdditionalURL += temp + tempArray[i]; temp = "&"; } } } else { var tmpAncor = baseURL.split("#"); var TheParams = tmpAncor[0]; TheAncor = tmpAncor[1]; if(TheParams) baseURL = TheParams; } if(TheAncor) paramVal += "#" + TheAncor; var rows_txt = temp + "" + param + "=" + paramVal; return baseURL + "?" + newAdditionalURL + rows_txt; }
The above code adds a random number to the end of the URL or updates it if it exists to avoid caching the page. If you are all ready to avoid storing the page in the cache, you can do the same without the extra random parameter.
source share