Welcome

You could spend your whole life exploring the countryside of Ringkøbing Skjern Municipality.  We are proud to welcome you to an area that offers coastline, lakes, woods, valleys, meadows, heathlands, and moors. 

Whatever the time of year that you visit us, there is a wide variety of cultural life and other activities, both indoors and outdoors.

Error executing template "Designs/rksk/Paragraph/Sporgsmal_Svar.cshtml"
System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at CompiledRazorTemplates.Dynamic.RazorEngine_8ac2ba6d7dac4868b00011470539e1fd.get_article(String article_id, String endpoint_lang) in E:\dynamicweb.net\Solutions\rksk.net.dynamicweb-cms.com\Website\Files\Templates\Designs\rksk\Paragraph\Sporgsmal_Svar.cshtml:line 124
   at CompiledRazorTemplates.Dynamic.RazorEngine_8ac2ba6d7dac4868b00011470539e1fd.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\rksk.net.dynamicweb-cms.com\Website\Files\Templates\Designs\rksk\Paragraph\Sporgsmal_Svar.cshtml:line 199
   at CompiledRazorTemplates.Dynamic.RazorEngine_8ac2ba6d7dac4868b00011470539e1fd.Execute() in E:\dynamicweb.net\Solutions\rksk.net.dynamicweb-cms.com\Website\Files\Templates\Designs\rksk\Paragraph\Sporgsmal_Svar.cshtml:line 456
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 2 @using System; 3 @using System.Xml; 4 @using System.Xml.Linq; 5 @using HtmlAgilityPack; 6 @using Dynamicweb.Rendering; 7 8 @using System 9 @using System.Net; 10 @using System.IO; 11 @using System.Web; 12 13 @functions { 14 15 public string get_articles(string article_ids, string endpoint_lang="dansk"){ 16 17 if (string.IsNullOrEmpty(article_ids)) { 18 return ""; 19 }else{ 20 21 //The XML BORGER.DK 22 string[] articles = article_ids.Split(','); 23 24 String xmlString = @"<?xml version=""1.0"" encoding=""utf-8""?>"; 25 xmlString = xmlString + @"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:v1=""http://www.borger.dk/2009/WSArticleExport/v1"" xmlns:arr=""http://schemas.microsoft.com/2003/10/Serialization/Arrays"">"; 26 xmlString = xmlString + "<soapenv:Header/>"; 27 xmlString = xmlString + "<soapenv:Body>"; 28 xmlString = xmlString + "<v1:GetArticlesByIDs>"; 29 xmlString = xmlString + "<v1:articleIDs>"; 30 31 foreach (string article in articles){ 32 xmlString = xmlString + "<arr:int>"+article+"</arr:int>"; 33 } 34 35 xmlString = xmlString + "</v1:articleIDs>"; 36 xmlString = xmlString + "<v1:municipalityCode>760</v1:municipalityCode>"; 37 xmlString = xmlString + "</v1:GetArticlesByIDs>"; 38 xmlString = xmlString + "</soapenv:Body>"; 39 xmlString = xmlString + "</soapenv:Envelope>"; 40 41 42 //CALL TO BORGER.DK 43 44 string endpoint = ""; 45 if(endpoint_lang =="engelsk"){ 46 endpoint = "https://lifeindenmark.borger.dk/_vti_bin/borger/ArticleExport.svc?wsdl"; 47 }else{ 48 endpoint = "https://www.borger.dk/_vti_bin/borger/ArticleExport.svc?wsdl"; 49 //endpoint = "https://artikel.borger.dk/ArticleExport.svc?wsdl"; 50 } 51 52 HttpWebRequest req = (HttpWebRequest) WebRequest.Create(endpoint); 53 req.Headers.Add("SOAPAction", "\"http://www.borger.dk/2009/WSArticleExport/v1/IArticleExport/GetArticlesByIDs\""); 54 req.ContentType = "text/xml;charset=\"utf-8\""; 55 req.Accept = "text/xml"; 56 req.Method = "POST"; 57 58 //OUTPUT TO STREAM 59 using (Stream stm = req.GetRequestStream()){ 60 using (StreamWriter stmw = new StreamWriter(stm)){ 61 stmw.Write(xmlString); 62 } 63 } 64 65 //GET RESPONSE + READ CONTENT 66 WebResponse response = req.GetResponse(); 67 Stream responseStream = response.GetResponseStream(); 68 StreamReader reader = new StreamReader(responseStream); 69 string responseFromServer = reader.ReadToEnd(); 70 71 //return response 72 return responseFromServer; 73 74 } 75 } 76 77 78 public string get_article(string article_id, string endpoint_lang="dansk"){ 79 80 string cacheKey = "cacheBorgerDK" + article_id + endpoint_lang; 81 var responseFromServer = (string) HttpContext.Current.Cache[cacheKey]; 82 83 if (responseFromServer == null){ 84 var cTime = DateTime.Now.AddMinutes(60*24); 85 var cExp = System.Web.Caching.Cache.NoSlidingExpiration; 86 var cPri = System.Web.Caching.CacheItemPriority.Normal; 87 88 //The XML BORGER.DK 89 String xmlString = @"<?xml version=""1.0"" encoding=""utf-8""?>"; 90 xmlString = xmlString + @"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:v1=""http://www.borger.dk/2009/WSArticleExport/v1"" xmlns:arr=""http://schemas.microsoft.com/2003/10/Serialization/Arrays"">"; 91 xmlString = xmlString + "<soapenv:Header />"; 92 xmlString = xmlString + "<soapenv:Body>"; 93 xmlString = xmlString + "<v1:GetArticleByID>"; 94 xmlString = xmlString + "<v1:articleID>"+article_id+"</v1:articleID>"; 95 xmlString = xmlString + "<v1:municipalityCode>760</v1:municipalityCode>"; 96 xmlString = xmlString + "</v1:GetArticleByID>"; 97 xmlString = xmlString + "</soapenv:Body>"; 98 xmlString = xmlString + "</soapenv:Envelope>"; 99 100 //endpoint 101 string endpoint = ""; 102 if(endpoint_lang=="engelsk"){ 103 endpoint = "https://lifeindenmark.borger.dk/_vti_bin/borger/ArticleExport.svc?wsdl"; 104 }else{ 105 endpoint = "https://www.borger.dk/_vti_bin/borger/ArticleExport.svc?wsdl"; 106 //endpoint = "https://artikel.borger.dk/ArticleExport.svc?wsdl"; 107 } 108 109 //CALL TO BORGER.DK 110 HttpWebRequest req = (HttpWebRequest) WebRequest.Create(endpoint); 111 req.Headers.Add("SOAPAction", "\"http://www.borger.dk/2009/WSArticleExport/v1/IArticleExport/GetArticleByID\""); 112 req.ContentType = "text/xml;charset=\"utf-8\""; 113 req.Accept = "text/xml"; 114 req.Method = "POST"; 115 116 //OUTPUT TO STREAM 117 using (Stream stm = req.GetRequestStream()){ 118 using (StreamWriter stmw = new StreamWriter(stm)){ 119 stmw.Write(xmlString); 120 } 121 } 122 123 //GET RESPONSE + READ CONTENT 124 WebResponse response = req.GetResponse(); 125 Stream responseStream = response.GetResponseStream(); 126 StreamReader reader = new StreamReader(responseStream); 127 responseFromServer = reader.ReadToEnd(); 128 129 HttpContext.Current.Cache.Insert(cacheKey, responseFromServer, null, cTime, cExp, cPri, null); 130 } 131 132 return responseFromServer; 133 } 134 135 136 137 } 138 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 139 @using System; 140 @using System.Xml; 141 @using System.Xml.Linq; 142 @using HtmlAgilityPack; 143 @using Dynamicweb.Rendering; 144 145 @helper render_sporgsmal(string item_overskrift, string item_indhold, int counter, string item_link = "", string item_borger_dk_id = "", string item_borger_dk_lang = "dansk", int item_id = 0) 146 { 147 148 var counter_borger_in_tabs = 0; 149 bool external_link = false; 150 String target_link = "_self"; 151 if (item_link.IndexOf("Default.aspx?ID=") == -1 && item_link.IndexOf("http") > -1) 152 { 153 external_link = true; 154 target_link = "_blank"; 155 } 156 string headerId = "headline-accordion-counter-" + counter; 157 if (item_id > 0) 158 { 159 headerId = "headline-accordion-system-" + item_id; 160 } 161 162 if (!string.IsNullOrWhiteSpace(item_link)) 163 { 164 <h2 class="questions--header hidden-print"> 165 <a href="@item_link" target="@target_link" class="clearfix"> 166 @item_overskrift 167 @if (external_link) 168 { 169 <text> - (Ekstern side)</text> 170 } 171 else 172 { 173 <text> - (Link)</text> 174 } 175 176 </a> 177 </h2> 178 } 179 else 180 { 181 <h2 class="questions--header"> 182 <button aria-expanded="false" class="Accordion-trigger reset-button" aria-controls="content-accordion-@counter" id="@headerId"> 183 @item_overskrift 184 </button> 185 </h2> 186 187 <div class="Accordion-panel questions--content" id="content-accordion-@counter" role="region" aria-labelledby="@headerId" hidden=""> 188 189 @if (!string.IsNullOrEmpty(item_borger_dk_id)) 190 { 191 //IF ANY BORGER DK, LETS GET THE ARTICLE 192 String responseFromServer_in_tabs = ""; 193 var header_in_tabs = ""; 194 var content_in_tabs = ""; 195 196 197 if (!string.IsNullOrEmpty(item_borger_dk_id)) 198 { 199 responseFromServer_in_tabs = get_article(item_borger_dk_id, item_borger_dk_lang); 200 201 XNamespace a_in_tabs = "http://www.borger.dk/2009/WSArticleExport/v1/types"; 202 XDocument doc_in_tabs = XDocument.Parse(responseFromServer_in_tabs); 203 header_in_tabs = (string)doc_in_tabs.Root.Descendants(a_in_tabs + "ArticleHeader").FirstOrDefault(); 204 content_in_tabs = (string)doc_in_tabs.Root.Descendants(a_in_tabs + "Content").FirstOrDefault(); 205 } 206 207 HtmlNodeCollection contentareas_in_tabs = null; 208 HtmlNodeCollection selvbetjeningList_in_tabs = null; 209 210 if (!string.IsNullOrEmpty(content_in_tabs)) 211 { 212 HtmlDocument htmldoc_in_tabs = new HtmlDocument(); 213 htmldoc_in_tabs.LoadHtml(content_in_tabs); 214 215 HtmlNode selvbetjening_in_tabs_tmp = htmldoc_in_tabs.DocumentNode.SelectSingleNode("//div[@id='selvbetjeningslinks']"); 216 if (selvbetjening_in_tabs_tmp != null) 217 { 218 selvbetjeningList_in_tabs = htmldoc_in_tabs.DocumentNode.SelectNodes("//div[@id='selvbetjeningslinks']//li/a"); 219 string[] myListNames_in_tabs = new string[selvbetjeningList_in_tabs.Count]; 220 int i = 0; 221 222 <div class="hidden questions--selfservice-hidden" aria-hidden="true"> 223 <ul> 224 @foreach (var linkSelvbetjening_in_tabs in selvbetjeningList_in_tabs) 225 { 226 string linkText_in_tabs = linkSelvbetjening_in_tabs.InnerText; 227 228 if (!myListNames_in_tabs.Contains(linkText_in_tabs)) 229 { 230 myListNames_in_tabs[i] = linkText_in_tabs; 231 i++; 232 233 <li> 234 <a href="@linkSelvbetjening_in_tabs.Attributes["href"].Value" title="@linkSelvbetjening_in_tabs.Attributes["title"].Value"> 235 @linkText_in_tabs 236 </a> 237 </li> 238 } 239 } 240 </ul> 241 </div> 242 } 243 244 string matchResultDivId_in_tabs = "kernetekst"; 245 string xpath_in_tabs = String.Format("//div[@id='{0}']/div", matchResultDivId_in_tabs); 246 contentareas_in_tabs = htmldoc_in_tabs.DocumentNode.SelectNodes(xpath_in_tabs); 247 } 248 249 <div class="Accordion-nested" data-allow-toggle> 250 @if (contentareas_in_tabs != null) 251 { 252 foreach (HtmlNode contentarea_in_tabs in contentareas_in_tabs) 253 { 254 255 counter_borger_in_tabs = counter_borger_in_tabs + 1; 256 257 HtmlDocument htmldoc2_in_tabs = new HtmlDocument(); 258 htmldoc2_in_tabs.LoadHtml(contentarea_in_tabs.InnerHtml); 259 260 HtmlNode item_overskrift_in_tabs_h2 = htmldoc2_in_tabs.DocumentNode.SelectSingleNode("//h2"); 261 HtmlNode item_overskrift_in_tabs_h3 = htmldoc2_in_tabs.DocumentNode.SelectSingleNode("//h3"); 262 var item_overskrift_in_tabs = ""; 263 264 if (item_overskrift_in_tabs_h2 != null) 265 { 266 item_overskrift_in_tabs = item_overskrift_in_tabs_h2.InnerHtml; 267 } 268 else if (item_overskrift_in_tabs_h3 != null) 269 { 270 item_overskrift_in_tabs = item_overskrift_in_tabs_h3.InnerHtml; 271 } 272 273 var item_indhold_in_tabs = htmldoc2_in_tabs.DocumentNode.SelectSingleNode("//div"); 274 if (item_indhold_in_tabs != null) 275 { 276 @render_sporgsmal_in_sporgsmal(item_overskrift_in_tabs, item_indhold_in_tabs.InnerHtml, counter_borger_in_tabs, counter, item_overskrift) 277 } 278 279 } 280 281 } 282 else if (!string.IsNullOrEmpty(content_in_tabs)) 283 { 284 @content_in_tabs 285 } 286 </div> 287 } 288 else 289 { 290 @item_indhold 291 } 292 </div> 293 } 294 } 295 296 @helper render_sporgsmal_in_sporgsmal(string item_overskrift, string item_indhold, int counter, int counterOuter, string containerOverskrift = "") 297 { 298 299 <h3 class="questions--header"> 300 <button aria-label="@containerOverskrift : @item_overskrift" aria-expanded="false" class="Accordion-nested-trigger reset-button" aria-controls="content-accordion-nested-@counterOuter-@counter" id="headline-accordion-nested-@counterOuter-@counter"> 301 @item_overskrift 302 </button> 303 </h3> 304 305 <div class="Accordion-reset-panel questions--content questions--content--simple" id="content-accordion-nested-@counterOuter-@counter" role="region" aria-labelledby="headline-accordion-nested-@counterOuter-@counter" hidden=""> 306 @item_indhold 307 </div> 308 309 } 310 311 @{ 312 var items = GetLoop("Item.Indhold"); 313 var item_borger_dk_id = GetValue("Item.BorgerDK").ToString(); 314 var item_borger_dk_lang = GetValue("Item.BorgerDK_Sprog").ToString(); 315 bool itemtype_selvbetjening = GetBoolean("Item.Selvbetjening"); 316 317 string itemtype_selvbetjening_class = ""; 318 if (itemtype_selvbetjening) 319 { 320 itemtype_selvbetjening_class = "questions--selfservice"; 321 } 322 } 323 324 @{ 325 //IF ANY BORGER DK, LETS GET THE ARTICLE 326 String responseFromServer = ""; 327 var header = ""; 328 var content = ""; 329 if (!string.IsNullOrEmpty(item_borger_dk_id)) 330 { 331 responseFromServer = get_article(item_borger_dk_id, item_borger_dk_lang); 332 333 XNamespace a = "http://www.borger.dk/2009/WSArticleExport/v1/types"; 334 XDocument doc = XDocument.Parse(responseFromServer); 335 header = (string)doc.Root.Descendants(a + "ArticleHeader").FirstOrDefault(); 336 content = (string)doc.Root.Descendants(a + "Content").FirstOrDefault(); 337 } 338 } 339 340 341 @if (items.Count > 0 || !string.IsNullOrEmpty(item_borger_dk_id)) 342 { 343 344 var counter_borger = 0; 345 346 HtmlNodeCollection contentareas = null; 347 HtmlNodeCollection selvbetjeningList = null; 348 if (!string.IsNullOrEmpty(content)) 349 { 350 HtmlDocument htmldoc = new HtmlDocument(); 351 htmldoc.LoadHtml(content); 352 353 HtmlNode selvbetjening_tmp = htmldoc.DocumentNode.SelectSingleNode("//div[@id='selvbetjeningslinks']"); 354 if (selvbetjening_tmp != null) 355 { 356 selvbetjeningList = htmldoc.DocumentNode.SelectNodes("//div[@id='selvbetjeningslinks']//li/a"); 357 } 358 359 string matchResultDivId = "kernetekst"; 360 string xpath = String.Format("//div[@id='{0}']/div", matchResultDivId); 361 contentareas = htmldoc.DocumentNode.SelectNodes(xpath); 362 363 } 364 365 <div class="questions--container @itemtype_selvbetjening_class" id="accordion"> 366 367 <div class="h2">@GetValue("Item.Overskrift")</div> 368 369 @if (selvbetjeningList != null) 370 { 371 string[] myListNames = new string[selvbetjeningList.Count]; 372 int i = 0; 373 374 <div class="selfservice--list js--selfservice--list"> 375 <h2 class="h3">Selvbetjening</h2> 376 <ul> 377 @foreach (var linkSelvbetjening in selvbetjeningList) 378 { 379 string linkText = linkSelvbetjening.InnerText; 380 381 if (!myListNames.Contains(linkText)) 382 { 383 myListNames[i] = linkText; 384 i++; 385 386 <li> 387 <a href="@linkSelvbetjening.Attributes["href"].Value" title="@linkSelvbetjening.Attributes["title"].Value" target="_blank"> 388 @linkText 389 </a> 390 </li> 391 } 392 } 393 </ul> 394 </div> 395 } 396 397 <div class="Accordion questions" data-allow-toggle> 398 @if (contentareas != null) 399 { 400 401 foreach (HtmlNode contentarea in contentareas) 402 { 403 404 counter_borger = counter_borger + 1; 405 406 HtmlDocument htmldoc2 = new HtmlDocument(); 407 htmldoc2.LoadHtml(contentarea.InnerHtml); 408 409 HtmlNode item_overskrift_h2 = htmldoc2.DocumentNode.SelectSingleNode("//h2"); 410 HtmlNode item_overskrift_h3 = htmldoc2.DocumentNode.SelectSingleNode("//h3"); 411 var item_overskrift = ""; 412 413 if (item_overskrift_h2 != null) 414 { 415 item_overskrift = item_overskrift_h2.InnerHtml; 416 } 417 else if (item_overskrift_h3 != null) 418 { 419 item_overskrift = item_overskrift_h3.InnerHtml; 420 } 421 422 var item_indhold = htmldoc2.DocumentNode.SelectSingleNode("//div").InnerHtml; 423 424 @render_sporgsmal(item_overskrift, item_indhold, counter_borger) 425 426 } 427 } 428 else if (!string.IsNullOrEmpty(content)) 429 { 430 @content 431 } 432 433 @for (var ii = 0; ii < items.Count; ii++) 434 { 435 436 counter_borger = counter_borger + 1; 437 438 var item = items[ii]; 439 440 int item_id = item.GetInteger("Item.Indhold.SystemID"); 441 if (item_id == null || item_id == 0) 442 { 443 item_id = item.GetInteger("Item.Indhold.Id"); 444 } 445 var item_overskrift = item.GetValue("Item.Indhold.Overskrift").ToString(); 446 var item_indhold = item.GetValue("Item.Indhold.Indhold").ToString(); 447 var item_borger_dk_id_in_tabs = item.GetValue("Item.Indhold.BorgerDK").ToString(); 448 var item_borger_dk_lang_in_tabs = item.GetValue("Item.Indhold.BorgerDK_Sprog").ToString(); 449 var item_link = item.GetValue("Item.Indhold.Link").ToString(); 450 if (!string.IsNullOrEmpty(item.GetValue("Item.Indhold.TilEksaktSpg_svar").ToString())) 451 { 452 item_link = item_link + item.GetValue("Item.Indhold.TilEksaktSpg_svar").ToString(); 453 } 454 455 456 @render_sporgsmal(item_overskrift, item_indhold, counter_borger, item_link, item_borger_dk_id_in_tabs, item_borger_dk_lang_in_tabs, item_id) 457 458 } 459 460 </div> 461 </div> 462 }
Kontaktoplysninger
Ringkøbing-Skjern Kommune
See contact info entries subtopic
Ringkøbing-Skjern Kommune
Ved Fjorden 6
6950 Ringkøbing