Category: c#

Code to check when page has finished loading

Does this link answer your question? Example usage (in your C# code) protected void Page_Load(object sender, EventArgs e) { Page.LoadComplete +=new EventHandler(Page_LoadComplete); } void Page_LoadComplete(object sender, EventArgs e) { // call your download function }

Parse query string

var qs = HttpUtility.ParseQueryString(Request.Url.Query); qs.Remove("foo"); string url = "~/Default.aspx"; if (qs.Count > 0) url = url + "?" + qs.ToString(); Response.Redirect(url); ===================================================== A lot of the answers are providing custom examples because of the accepted answer’s dependency on System.Web. From the Microsoft.AspNet.WebApi.Client NuGet package there is a UriExtensions.ParseQueryString, method that can also be used: var uri = new Uri("https://stackoverflow.com/a/22167748?p1=6&p2=7&p3=8"); […]