Exception in template (Designs/Dwsimple/Paragraph/NewsHorisontal.cshtml): System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
   at System.Net.HttpWebRequest.GetResponse()
   at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
   at CompiledRazorTemplates.Dynamic.fcfcaebedeeddc.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@using System.Xml.Linq; @using System.Text; @using System.Globalization; @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ init(); } @functions { private int columnsWritten { get; set; } private int columns { get; set; } public void init() { columnsWritten = Dynamicweb.Input.FormatInteger(System.Web.HttpContext.Current.Items["currentColumns"]); columns = GetInteger("Item.Width"); System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + GetInteger("Item.Width"); } public void Fluid() { columnsWritten = Dynamicweb.Input.FormatInteger(System.Web.HttpContext.Current.Items["currentColumns"]); columns = 12; System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + 12; } public string ColumnClass() { if (GetString("Item.WidthMobile") == "hide"){ return "col-md-" + GetString("Item.Width") + " hidden-xs"; } else { return "col-md-" + GetString("Item.Width") + " col-xs-" + GetString("Item.WidthMobile"); } } public string NewRow() { if (columns + columnsWritten > 12) { System.Web.HttpContext.Current.Items["currentColumns"] = columns; return "</div><div class=\"row\">"; } else { return string.Empty; } } } @NewRow() <h1>@GetString("Item.Titel")</h1> <div class="row"> @{ string linkstring = GetString("Item.FeedLink")+"&InKontonr="+GetString("Item.AccountNumber"); XDocument xdoc = XDocument.Load(linkstring); var elements = xdoc.Element("DATA").Elements("NYHED"); int counter = 0; foreach (var el in elements) { string id = "0"; string title = "Title"; string description = "Description"; string linkText = "LinkText"; string linkUrl = "LinkUrl"; string document = "Document"; if (el.Elements("ID").Any()){ id = el.Element("ID").Value; } if (el.Elements("OVERSKRIFT").Any()){ title = el.Element("OVERSKRIFT").Value; } if (el.Elements("TEKST").Any()){ description = el.Element("TEKST").Value; } if (el.Elements("LINK_TEKST").Any()){ linkText = el.Element("LINK_TEKST").Value; } if (el.Elements("LINK_URL").Any()){ linkUrl = el.Element("LINK_URL").Value; } if (el.Elements("BILLEDE_URL").Any()){ document = "http://kalender.brandsoft.dk/bska/" + el.Element("BILLEDE_URL").Value; } counter += 1; id = counter.ToString(); if(counter <= 4) { <div class="col-md-3"> <img class="img-responsive" src="@document" alt=""></img> <h2>@title</h2> @{ string isHidden = ""; if (GetString("Item.ShowInfo") == "Closed" || GetString("Item.ShowInfo") == "Hidden"){ isHidden = "style=\"display:none;\""; } } <div id="@id" @isHidden> <p style="white-space: pre-line;">@description</p> @if(linkUrl != null) { <a href=@linkUrl>@linkText</a> } </div> @if (!string.IsNullOrWhiteSpace(description) || !string.IsNullOrWhiteSpace(document)){ if (GetString("Item.ShowInfo") == "Open"){ <div onclick="toggle_visibility('@id');"><p id="@(id)_chevron" class="text-center chevron"></p></div> } else if (GetString("Item.ShowInfo") == "Closed") { <div onclick="toggle_visibility('@id');"><p id="@(id)_chevron" class="text-center chevron bottom"></p></div> } } </div> } } } </div> <script type="text/javascript"> function toggle_visibility(id) { if($('#' + id + "_chevron").length){ $('#' + id).stop().slideToggle('slow'); $('#' + id + "_chevron").toggleClass('bottom'); alert(id); if(!$('#' + id + "_img").hasClass('bigPic')){ var container_width = $('#' + id + "_img").parent().width(); var image_height; var natural_width = document.getElementById(id + "_img").naturalWidth; var natural_height = document.getElementById(id + "_img").naturalHeight; if(natural_width < container_width){ //> container_width = natural_width; } var res = container_width / natural_width; image_height = natural_height * res; if(image_height > 400){ image_height = 400; } $('#' + id + "_img").addClass('bigPic'); $('#' + id + "_img").css('max-height', image_height + "px"); }else{ $('#' + id + "_img").removeClass('bigPic'); $('#' + id + "_img").css('max-height', "100px"); } } } </script>
Exception in template (Designs/Dwsimple/Paragraph/Calendar.cshtml): System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
   at System.Net.HttpWebRequest.GetResponse()
   at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
   at CompiledRazorTemplates.Dynamic.cbcbbbbfcad.b__0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.Write(TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.cbcbbbbfcad.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@using System.Xml.Linq; @using System.Text; @using System.Globalization; @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ init(); } @functions { private int columnsWritten { get; set; } private int columns { get; set; } public void init() { columnsWritten = Dynamicweb.Input.FormatInteger(System.Web.HttpContext.Current.Items["currentColumns"]); columns = GetInteger("Item.Width"); System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + GetInteger("Item.Width"); } public void Fluid() { columnsWritten = Dynamicweb.Input.FormatInteger(System.Web.HttpContext.Current.Items["currentColumns"]); columns = 12; System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + 12; } public string ColumnClass() { if (GetString("Item.WidthMobile") == "hide"){ return "col-md-" + GetString("Item.Width") + " hidden-xs"; } else { return "col-md-" + GetString("Item.Width") + " col-xs-" + GetString("Item.WidthMobile"); } } public string NewRow() { if (columns + columnsWritten > 12) { System.Web.HttpContext.Current.Items["currentColumns"] = columns; return "</div><div class=\"row\">"; } else { return string.Empty; } } } @NewRow() <div class="@ColumnClass()"> <h1>@GetString("Item.Titel")</h1> @if (@GetString("Item.LayoutMode") == "list") { @CalendarList(); } else { string thisyear = ""; <ul class="timeline hidden-xs"> @{ DateTime EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")); String StartDate = DateTime.Now.ToString("dd/MM/yyyy"); String Limit = int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands).ToString(); if (GetBoolean("Item.StartDateNow") == false){ EndDate = Convert.ToDateTime(GetString("Item.StartDate")).AddDays(GetInteger("Item.Days")); StartDate = GetString("Item.StartDate"); } string linkstring = GetString("Item.FeedLink")+"&InKontonr="+GetString("Item.AccountNumber")+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate.ToString("dd/MM/yyyy"); if (GetString("Item.Show.Filter") != "alle"){ linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); } XDocument xdoc = XDocument.Load(linkstring); var elements = xdoc.Element("DATA").Elements("AFTALE"); foreach (var el in elements) { string id = "0"; string type = "alle"; DateTime date; string title = "Title"; string description = "Description"; string fulldate = "Date"; string cleanDate = ""; string location = ""; string document = ""; string document_type = "document"; if (el.Elements("ID").Any()){ id = el.Element("ID").Value; } if (el.Elements("AFTALETYPE").Any()){ type = el.Element("AFTALETYPE").Value; } if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); cleanDate = date.ToString("dddd d. MMMM kl. HH:mm", new CultureInfo("da-DK")); } if (el.Elements("OVERSKRIFT").Any()){ title = el.Element("OVERSKRIFT").Value; } if (el.Elements("BESKRIVELSE").Any()){ description = el.Element("BESKRIVELSE").Value; } if (el.Elements("DATO_FORMATERET").Any()){ fulldate = el.Element("DATO_FORMATERET").Value; } if (el.Elements("STED").Any()){ location = el.Element("STED").Value; } if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){ document = "http://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value; } if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){ document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value; } <li class="event"> <div class="event-date"> <h3>@title</h3> </div> <div class="event-body"> <div class="row"> <div class="col-md-12"> <p> @description </p> @if (location != ""){ <p><i>@location</i></p> } @if (document != ""){ <a href="@document" class="btn btn-dw-primary pull-right" download>Download dokument</a> } </div> </div> </div> <div class="event-footer"> <ul class="aux-info-cells"> <li><span class="label label-default">@type</span> &nbsp;&nbsp; @fulldate</li> </ul> </div> </li> } } </ul> <div class="hidden-lg hidden-md hidden-sm"> @CalendarList(); </div> } </div> @helper CalendarList(){ <ul class="list-listings blog-list"> @{ DateTime EndDate = DateTime.Now.AddDays(GetInteger("Item.Days")); String StartDate = DateTime.Now.ToString("dd/MM/yyyy"); String Limit = int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands).ToString(); if (GetBoolean("Item.StartDateNow") == false){ EndDate = Convert.ToDateTime(GetString("Item.StartDate")).AddDays(GetInteger("Item.Days")); StartDate = GetString("Item.StartDate"); } string linkstring = GetString("Item.FeedLink")+"&InKontonr="+GetString("Item.AccountNumber")+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate.ToString("dd/MM/yyyy"); if (GetString("Item.Show.Filter") != "alle"){ linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter"); } XDocument xdoc = XDocument.Load(linkstring); var elements = xdoc.Element("DATA").Elements("AFTALE"); foreach (var el in elements) { string id = "0"; string type = "alle"; DateTime date; string title = "Title"; string description = "Description"; string fulldate = "Date"; string cleanDate = ""; string day = ""; string month = ""; string location = ""; string document = ""; if (el.Elements("ID").Any()){ id = el.Element("ID").Value; } if (el.Elements("AFTALETYPE").Any()){ type = el.Element("AFTALETYPE").Value; } if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) { date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK")); cleanDate = date.ToString("dddd d. MMMM kl. HH:mm", new CultureInfo("da-DK")); day = date.ToString(" d", new CultureInfo("da-DK")); month = date.ToString("MMM", new CultureInfo("da-DK")); } if (el.Elements("OVERSKRIFT").Any()){ title = el.Element("OVERSKRIFT").Value; } if (el.Elements("BESKRIVELSE").Any()){ description = el.Element("BESKRIVELSE").Value; } if (el.Elements("DATO_FORMATERET").Any()){ fulldate = el.Element("DATO_FORMATERET").Value; } if (el.Elements("STED").Any()){ location = el.Element("STED").Value; } if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any()){ foreach(var doc in el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT")) { if (doc.Element("DOKUMENTTYPE").Value == "OFFENTLIGT_AFTALE_BILLEDE"){ document = "http://kalender.brandsoft.dk/bska/" + doc.Element("URL").Value; break; } } } string link_start = ""; string link_end = ""; if (GetString("Item.ShowInfo") != "Hidden"){ link_start = "<div href=\"#\" onclick=\"toggle_visibility("+id+");\" style=\"cursor:pointer\">"; link_end = "</div>"; } string registration_url = "https://kalenderhtml5.brandsoft.dk/#/event/" + GetString("Item.AccountNumber") + "/" + id; @link_start <div class="row"> <div class="media col-md-12"> <div class="media-left"> <div class="media-object calendar-date bg-primary color-secondary text-center"><span>@day</span> @month</div> </div> <div class="media-body"> <h2 class="media-heading color-primary">@title</h2> @* <a href="@registration_url" target="_blank">Tilmeld</a> *@ <p class="list-item-info">@type</p> <p class="list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @fulldate</p> <p class="list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p> @{ string isHidden = ""; if (GetString("Item.ShowInfo") == "Closed" || GetString("Item.ShowInfo") == "Hidden"){ isHidden = "style=\"display:none;\""; } } <div id="@id" @isHidden> <p>@description</p> @{ var document_elements = el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT"); foreach(var doc in document_elements) { if(doc.Element("DOKUMENTTYPE").Value == "OFFENTLIGT_DOKUMENT") { string name = doc.Element("ORG_FILNAVN").Value; string url = "http://kalender.brandsoft.dk/bska/" + doc.Element("URL").Value; <br> <i class="fa fa-fw fa-file-o list-item-info"></i><a href="@url" target="_blank" class="document-link">@name</a> } } } </div> </div> <div class="media-right hidden-xs" style="width: 33%;"> @if (document != ""){ if (GetString("Item.ShowInfo") == "Open"){ <img class="img-responsive bigPic" src="@document" alt="" id="@(id)_img" style="max-height: 500px; float:right; position: relative;"></img> } else { <img class="img-responsive" src="@document" alt="" id="@(id)_img" style="max-height: 100px; float:right; position: relative;"></img> } } </div> </div> </div> if (!string.IsNullOrWhiteSpace(description) || !string.IsNullOrWhiteSpace(document)){ if (GetString("Item.ShowInfo") == "Open"){ <p id="@(id)_chevron" class="text-center chevron"></p> } else if (GetString("Item.ShowInfo") == "Closed") { <p id="@(id)_chevron" class="text-center chevron bottom"></p> } } @link_end <hr> } } </ul> } <script type="text/javascript"> function toggle_visibility(id) { if($('#' + id + "_chevron").length){ $('#' + id).stop().slideToggle('slow'); $('#' + id + "_chevron").toggleClass('bottom'); var image = $('#' + id + "_img") if(image.length && !image.hasClass('bigPic')){ var container_width = image.parent().width(); var image_height; var natural_width = document.getElementById(id + "_img").naturalWidth; var natural_height = document.getElementById(id + "_img").naturalHeight; if(natural_width < container_width){ //> container_width = natural_width; } var res = container_width / natural_width; image_height = natural_height * res; if(image_height > 400){ image_height = 400; } image.addClass('bigPic'); image.css('max-height', image_height + "px"); }else{ image.removeClass('bigPic'); image.css('max-height', "100px"); } } } </script>