On one of my web pages, the controls are based on the values โโdefined in some xml files on another remote server. Therefore, I need to load and analyze them on the load_ page () and display the controls. The problem is that the xml files are quite large and time consuming. Therefore, I want to download xml files using the webclient.DownloadFileAsync () method and show information about how many bytes are loaded.
I wrote the code for downloading files, but I donโt know how to update the page on the DownloadProgressChanged event.I think this requires ajax methods.Kindly guide me how to do this.
aspx page
<form id="form1" runat="server"> </asp:ScriptManager> <div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <br /> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> </div> </form>
Code for (thanks to another stack question)
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } private Queue<string> _downloadUrls = new Queue<string>(); private void downloadFile(IEnumerable<string> urls) { foreach (var url in urls) { _downloadUrls.Enqueue(url); }
Web e source share