I have a custom dll loaded into my web application, I updated it and reloaded the reference in my main web app. Basically the way it works is a user uploads a file that gets checked by a function in the dll. The user can then click a button on the results section that redirects to the main section of the app so they have a choice of rerunning the checker; I say section because the web app uses a single page with two divs, one for the form and one for the results, the code behind then swaps the visibility of the form div from the results div, here's the basic layout to clarify.
<body>
<div id="divForm" style="visibility: visible;">
</div>
<div id="divResults">
</div>
</body>
The redirect call is in the code behind as follows:
protected void btnReturn_Click(object sender, EventArgs e)
{
Response.Redirect("http://localhost/file_checker/");
}
And the main piece of the file checker:
protected void Page_Load(object sender, EventArgs e)
{
divForm.Visible = true;
divResults.Visible = false;
if (Page.IsPostBack)
{
//Do file checking
//Show results
divResults.Visible = true;
divForm.Visible = false;
}
}
The web app works fine on the first pass, however, I notice strange behavior after every subsequent pass. For example, I notice that the results page shows stale content from an older version of dll, i.e. It displays a string that was generated by an older version of the dll, I had removed the string and yet it still gets generated. I'm not sure if I'm redirecting correctly or if there's some other fundamental misunderstanding I have with how redirects work. Any help or insight is appreciated.
UPDATE:
Ok, instead of redirecting, I just cleared a gridview in my results section and swapped the styles of the divs to show the main section and hide the results section as follows:
protected void btnReturn_Click(object sender, EventArgs e)
{
//Clear the Gridview and show the upload Form
GridView1.DataSource = null; //<--Is popoulated by a DataTable
divForm.Visible = true;
divResults.Visible = false;
//Response.Redirect("http://localhost/file_checker/");
}
That seems to fix the problem, a lingering question I have is, I'm using a Datatable to populate the Gridview in the results page. Does the Datatable automatically dispose itself after each page load or button click event? Or will it persist? I just want to avoid any memory leak issues, since each page load instantiates a new DataTable object.