Click here to Skip to main content
15,913,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm developing a webform application that uses a generic handler to receive HTTP POST and retrieve data from it in order to write them into database and then display it in the GridView control of the main page. I want to make the main page been automatically refreshed once the generic handler receives a HTTP Post, but it can't and I have to click the refresh button on the browser to update its data content. I searched online about the code of refreshing pages and tried something like this:
public void ProcessRequest(HttpContext context)
    {
        //Parse and process data from received HTTP Post
        context.Response.Redirect("~/Main.aspx");
    }

But it doesn't work. Can anyone solve my question?
Posted
Updated 24-Sep-15 4:48am
v2
Comments
F-ES Sitecore 24-Sep-15 12:19pm    
A handler can't force a refresh of the page that calls it. You need to update the code that calls the handler to issue a refresh (it can issue a redirect to itself) after the handler has called. The refresh can't be done from the handler itself.
Ivan.0 25-Sep-15 2:05am    
Actually I haven't wrote any code to call the handler. It's automatically invoked by the server once a new HTTP Post is sent to there.

1 solution

Try adding a "cache-buster" querystring variable to the URL:
C#
context.Response.Redirect("~/Main.aspx?dummy=" + DateTime.UtcNow.Ticks);
 
Share this answer
 
Comments
Ivan.0 25-Sep-15 4:49am    
I tried it and it doesn't work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900