/// <summary> /// Defines the parameters for the X-Frame-Options header sent in response to clients /// </summary> /// <param name="value">The Value to be applied to the header X-Frame-Options header</param> /// <param name="allowFromUrl">If ALLOW-FROM is selected, then this value is /// required and must have sited that are permitted to frame your site. /// Note: Chrome does not support the ALLOW-FROM option /// Null by default</param> public XFrameOptionsOptions(XFrameOptionsValues value, string allowFromUrl = null) { HeaderValue = value; if (value == XFrameOptionsValues.AllowFrom && string.IsNullOrWhiteSpace(allowFromUrl)) { throw new ArgumentException("ALLOW-FROM URL string cannot be empty when ALLOW-FROM option is selected."); } AllowFromUrl = allowFromUrl; }
/// <summary> /// Defines the parameters for the X-Frame-Options header sent in response to clients /// </summary> /// <param name="xFrameOption">x-frame options</param> /// <param name="url">If ALLOW-FROM is selected, then this value is /// required and must have sited that are permitted to frame your site. /// Note: Chrome does not support the ALLOW-FROM option /// Null by default</param> public XFrameOptionsModel(XFrameOptionsValues xFrameOption, string url = null) { if (xFrameOption == XFrameOptionsValues.AllowFrom && string.IsNullOrWhiteSpace(url)) { throw new ArgumentException("ALLOW-FROM URL string cannot be empty when ALLOW-FROM option is selected."); } XFrameOption = xFrameOption; Url = url; }