title: Refresh asp.net page from a code-behind file
body: <p>I have an ASP.NET website and a seperate C# application. The application writes data to a file, the website populates the treeview with the data in the file. I populate the treeview in the page Load event.</p>
  
  <p>The website checks if the file has changed. This happens from a code behind file. If the file did change, the website needs to be refreshed. I cannot use <code>Response.Redirect</code> because I get a</p>
  
  <blockquote>
    <p>Response is not available in this context</p>
  </blockquote>
  
  <p>I tried <code>System.Web.HttpContext.Current.Response.Redirect</code>, but this gives me a NullReference.</p>
  
  <p>How can I refresh the page from a code behind file, so that it loads the right data in the treeview? Other suggestions that work but use something else than refreshing the page are welcome. Thanks in advance!</p>
  
  <p><strong>Edit:</strong> The actual problem is dynamically updating the treeview (new data = updated treeview). I have tried to do something with data from a MySql database but failed. The idea is the same, except the data isn't coming from a file but from a database. I added this because I thought this info might help users understand my problem.</p>