/// <summary> /// Get HTML code using server or client method and removes HTML comments /// </summary> /// <param name="url">URL to obtain HTML from</param> private string GetHtmlWithoutComments(string url) { string html; if (UseServerRequestType) { // Create web client and try to obtain HTML using it WebClient client = new WebClient(); try { StreamReader reader = StreamReader.New(client.OpenRead(url)); html = reader.ReadToEnd(); } catch (Exception e) { mErrorText = String.Format(ResHelper.GetString("validation.exception"), e.Message); return(null); } } else { // Get HTML stored using javascript html = ValidationHelper.Base64Decode(hdnHTML.Value); } return(Regex.Replace(html, "<!--.*?-->|<!--.*?$", "", RegexOptions.Multiline)); }
/// <summary> /// Get HTML code using server or client method /// </summary> /// <param name="url">URL to obtain HTML from</param> private string GetHtml(string url) { string html; if (UseServerRequestType) { // Create web client and try to obtain HTML using it using (WebClient client = new WebClient()) { try { using (var reader = StreamReader.New(client.OpenRead(url))) { html = reader.ReadToEnd(); } } catch (Exception e) { mErrorText = String.Format(ResHelper.GetString("validation.exception"), e.Message); return(null); } } } else { // Get HTML stored using javascript html = ValidationHelper.Base64Decode(hdnHTML.Value); } return(RemoveVirtualContextDataFromUrls(html, CultureCode)); }
/// <summary> /// Get HTML code using server or client method /// </summary> /// <param name="url">URL to obtain HTML from</param> private string GetHtml(string url) { if (UseServerRequestType) { // Create web client and try to obtain HTML using it using (WebClient client = new WebClient()) { try { using (StreamReader reader = StreamReader.New(client.OpenRead(url))) { return(reader.ReadToEnd()); } } catch (Exception e) { mErrorText = String.Format(ResHelper.GetString("validation.exception"), e.Message); return(null); } } } else { // Get HTML stored using JavaScript return(ValidationHelper.Base64Decode(hdnHTML.Value)); } }
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument) { txtCodeText.Text = ValidationHelper.Base64Decode(hdnHTML.Value); if (txtCodeText.Language == LanguageEnum.CSS) { txtCodeText.Text = txtCodeText.Text.Trim(new char[] { '\r', '\n' }); } hdnHTML.Value = ""; }
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument) { txtCodeText.Text = DocumentValidator.RemoveVirtualContextDataFromUrls(ValidationHelper.Base64Decode(hdnHTML.Value), CultureCode); if (txtCodeText.Language == LanguageEnum.CSS) { txtCodeText.Text = txtCodeText.Text.Trim(new[] { '\r', '\n' }); } InitPosition(); hdnHTML.Value = ""; }
private string GetHtml(string url) { if (UseServerRequestType) { // Create web client and try to obtaining HTML using it WebClient client = new WebClient(); try { StreamReader reader = StreamReader.New(client.OpenRead(url)); return(reader.ReadToEnd()); } catch { return(null); } } else { // Get HTML stored using javascript return(ValidationHelper.Base64Decode(hdnHTML.Value)); } }
/// <summary> /// Get HTML code using server or client method /// </summary> /// <param name="url">URL to obtain HTML from</param> private string GetHtml(string url) { if (UseServerRequestType) { // Create web client and try to obatin HTML using it WebClient client = new WebClient(); try { StreamReader reader = StreamReader.New(client.OpenRead(url)); return(reader.ReadToEnd()); } catch (Exception e) { lblError.Text = String.Format(ResHelper.GetString("validation.exception"), e.Message); lblError.Visible = true; return(null); } } else { // Get HTML stored using javascript return(ValidationHelper.Base64Decode(hdnHTML.Value)); } }