locked
Need to refresh one page and stop refreshing RRS feed

  • Question

  • User-909867351 posted

    Hi

    I need to refresh one webpage with 

    Response.AppendHeader("refresh", "5");

    after Add_XML

    It doesn't work with response.redirect();

    In Chrome it doesn't work too, maybe one Chrome option has to be enabled but I don't know what

    but I need to stop refreshing , i.e I need to refresh only one time. 

    Here is my code

    protected void Page_Load(object sender, EventArgs e)
        {
    
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetExpires(DateTime.Now);
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetNoStore();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.AppendHeader("refresh", "5");
        }
        protected void Add_XML(object sender, EventArgs e)
        {
            //XElement xml = XElement.Load("c:\\calendar\\eventos_professor.xml");
            XElement xml = XElement.Load("mypath\\eventos_professor.xml");
            xml.Add(new XElement("event",
            new XAttribute("title", "Agora sim"),
            new XAttribute("start", "2018-07-23 19:45:00"),
            new XAttribute("end", "2018-07-23 21:45:00")));
            xml.Save("mypath\\eventos_professor.xml");              
            //xml.Save("c:\\calendar\\eventos_professor.xml");
        }

    How to refresh onte time only after the Add_Xml?

    Thank you

    Friday, July 27, 2018 8:26 AM

Answers

  • User753101303 posted

    My understanding is that the issue is that the XML file requested using Ajax is cached. Have you tried change the jQuery cache option: see http://api.jquery.com/jquery.ajax/ and scroll down to "cache".

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 27, 2018 9:40 AM

All replies

  • User753101303 posted

    Hi,

    You would need to know that Add_XML will be called to skip adding your refresh line. If you give the full picture there is perhaps another approach. Is suspect that rather than a real requirement, it coluld be your current approach for trying to solve a problem you have maybe with caching ?

    Friday, July 27, 2018 8:38 AM
  • User-909867351 posted

    Yes You're right

    I have caching problems and I can't refresh the browser for reading my xml file. Please look at my other post to understand my problem

    https://forums.asp.net/t/2144352.aspx?Fullcalendar+does+not+refresh+on+website

    It only works in Firefox with the command 

    Response.AppendHeader("refresh", "5");

    but I need to stop the command, otherwhise I can't insert events in my calendar.

    I don't know why it does not refresh in Chrome, maybe one option is misconfigured ...

    Friday, July 27, 2018 9:08 AM
  • User753101303 posted

    My understanding is that the issue is that the XML file requested using Ajax is cached. Have you tried change the jQuery cache option: see http://api.jquery.com/jquery.ajax/ and scroll down to "cache".

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 27, 2018 9:40 AM
  • User-909867351 posted

    You are 100% right

    I spend 2 days to understant what was the problem, and now works fine. Great help, thank you

    Friday, July 27, 2018 10:07 AM