I am trying to figure out if I have something wrong with my architecture, or if I am just in need of a quick fix.
I have the following on my page:
<div ID="UploadDashboardDecorationZone">
<fieldset id="UploadDashboard">
<legend>Upload Dashboard</legend>
<telerik:RadUpload ID="UploadDashboardSelector" Runat="server" Width="235px" AllowedFileExtensions=".xml" MaxFileInputsCount="1" ControlObjectsVisibility="None" />
</fieldset>
<div class="BottomButton">
<telerik:RadButton ID="SubmitUploadDashboardButton" Runat="Server" Text="Upload" OnClientClicked="CloseUploadDashboard" />
</div>
</div>
The user selects a file they wish to upload, then they press the SubmitUploadDashboardButton.
I then have the following server-side code:
protected void Page_Init(object sender, EventArgs e)
{
if (Request.Files.Count > 0) HandleUploadedFile();
}
This all works great. The uploaded file is responded to and I see the changes on my page. The only problem is that I have left my page's request HTTP Method as POST and not GET. This means that bad things will happen if the user refreshes the page.
Previously, I had used the following code-snippet to resolve this issue:
Page.Response.Redirect(Page.Request.Url.ToString(), true);
Unfortunately, this does not work for me anymore. I don't want the flashing that happens with reloading the page (in addition to some code issues that arise with reloading).
What are my other options here? If I wrap UploadDashboardDecorationZone
with an UpdatePanel, then Request.Files comes out as 0.
Is there a quick code-fix for this that is common? Or am I missing something deeper in my understanding of how the file upload process works?
Thanks.