public IActionResult Page(string url, string collectionId) { if (string.IsNullOrWhiteSpace(url)) { return(View("Index")); } if (!url.StartsWith("http://") && !url.StartsWith("https://")) { return(View("Index")); } var collectionName = collectionId ?? "www"; try { _crawlQueue.Enqueue(new Uri(url)); return(Redirect("/add/thankyou")); } catch (Exception ex) { // TODO: add logging framework System.IO.File.WriteAllText(string.Format("_{0}_{1}.log", DateTime.Now.ToBinary(), WebUtility.UrlEncode(url)), ex.ToString()); return(View("Error")); } }
public IActionResult Page(string url, string collection) { if (string.IsNullOrWhiteSpace(url)) { return(View("Index")); } if (!url.StartsWith("http://") && !url.StartsWith("https://")) { return(View("Index")); } var collectionName = collection ?? Config.Get("default_collection"); try { var uri = new Uri(url); _crawlQueue.Enqueue(collectionName, uri); var q = Uri.EscapeDataString(_crawlQueue.GetTitle(uri)); return(Redirect($"/submitpage/thankyou?url={url}&q={q}")); } catch (Exception ex) { this.Log("{0} {1}", WebUtility.UrlEncode(url), ex); return(View("Error")); } }