Error executing template "Designs/Tjlaan2013/_parsed/SubPage-Ansoegningsblanket-Sendt.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f448b2d40ccb42c5b6fd0872b0660dec.Ansoegningsblanket.HexToBytes(String hex) in D:\home\site\wwwroot\Files\Templates\Designs\Tjlaan2013\_parsed\SubPage-Ansoegningsblanket-Sendt.parsed.cshtml:line 372
   at CompiledRazorTemplates.Dynamic.RazorEngine_f448b2d40ccb42c5b6fd0872b0660dec.Ansoegningsblanket.XorDecrypt(String value) in D:\home\site\wwwroot\Files\Templates\Designs\Tjlaan2013\_parsed\SubPage-Ansoegningsblanket-Sendt.parsed.cshtml:line 408
   at CompiledRazorTemplates.Dynamic.RazorEngine_f448b2d40ccb42c5b6fd0872b0660dec.Execute() in D:\home\site\wwwroot\Files\Templates\Designs\Tjlaan2013\_parsed\SubPage-Ansoegningsblanket-Sendt.parsed.cshtml:line 432
   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 Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 @using System.Web 3 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4 5 @SnippetStart("Icons") 6 @if(!string.IsNullOrEmpty(Model.Area.Item.GetString("Icons_Favicon"))) { 7 string favIcon = Model.Area.Item.GetString("Icons_Favicon"); 8 <link rel="shortcut icon" href="@favIcon" /> 9 } 10 @if(!string.IsNullOrEmpty(Model.Area.Item.GetString("Icons_SmartphoneIcon"))) { 11 var smartphoneIcon = Model.Area.Item.GetString("Icons_SmartphoneIcon"); 12 <link rel="apple-touch-icon" href="@smartphoneIcon" /> 13 } 14 @if(!string.IsNullOrEmpty(Model.Area.Item.GetString("Icons_FacebookShareIcon"))) { 15 var facebookShareIcon = Model.Area.Item.GetString("Icons_FacebookShareIcon"); 16 <link rel="image_src" href="@facebookShareIcon" /> 17 } 18 @SnippetEnd("Icons") 19 @SnippetStart("GoogleAnalytics") 20 @if(!string.IsNullOrEmpty(Model.Area.Item.GetString("Google_Analytics_Code"))) { 21 <script type="text/javascript"> 22 var _gaq = _gaq || []; 23 _gaq.push(['_setAccount', '@Model.Area.Item.GetString("Google_Analytics_Code")']); 24 @if(!string.IsNullOrEmpty(Model.Area.Item.GetString("Google_Analytics_Domain"))) 25 { 26 @:_gaq.push(['_setDomainName', '@Model.Area.Item.GetString("Google_Analytics_Domain")']); 27 } 28 @{ 29 string allowLinker = Model.Area.Item.GetString("Google_Analytics_AllowLinker"); 30 if(!string.IsNullOrEmpty(allowLinker) && allowLinker != "false") 31 { 32 @: _gaq.push(['_setAllowLinker', 'true']); 33 } 34 } 35 _gaq.push(['_trackPageview']); 36 (function() { 37 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 38 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 39 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 40 })(); 41 </script> 42 } 43 @SnippetEnd("GoogleAnalytics") 44 @SnippetStart("CookieNotice") 45 @if(!string.IsNullOrEmpty(Model.Area.Item.GetString("ShowCookieNotice")) && !string.Equals(Model.Area.Item.GetString("ShowCookieNotice"), "False", StringComparison.CurrentCultureIgnoreCase)) { 46 <script src="/Files/Templates/CookieNotice/Script/jquery.cookie.js"></script> 47 <script src="/Files/Templates/CookieNotice/Script/jquery.skabertrang-cookie-notice.js"></script> 48 49 <script type="text/javascript"> 50 $(document).ready(function(){ 51 $.fn.skabertrangCookieNotice({ 52 @{ 53 string cookieIconPath = Model.Area.Item.GetString("Cookie_Icon"); 54 string closeIconPath = Model.Area.Item.GetString("Cookie_Close_Icon"); 55 string moreInfoUrl = Model.Area.Item.GetString("Cookie_More_Info_Url"); 56 string horizontalPosition = Model.Area.Item.GetString("Cookie_Horizontal_Position"); 57 string hideDelayTime = Model.Area.Item.GetString("Cookie_Initial_Hide_Delay_Time"); 58 string positionPriority = Model.Area.Item.GetString("Cookie_Auto_Adjust_Position_Priority"); 59 string showOnFirstVisit = Model.Area.Item.GetString("Cookie_Show_On_First_Visit"); 60 61 if(!string.IsNullOrEmpty(showOnFirstVisit) && !string.Equals(showOnFirstVisit, "False", StringComparison.CurrentCultureIgnoreCase)) 62 { 63 @: showOnFirstVisit: true, 64 } 65 } 66 iconPath: '@(!string.IsNullOrEmpty(cookieIconPath) ? cookieIconPath : "")', 67 closeIconPath: '@(!string.IsNullOrEmpty(closeIconPath) ? closeIconPath : "")', 68 cookiePageURL: '@(!string.IsNullOrEmpty(moreInfoUrl) ? moreInfoUrl : "")', 69 position: '@(!string.IsNullOrEmpty(horizontalPosition) ? horizontalPosition : "left")', 70 initialHideDelayTime: @(!string.IsNullOrEmpty(hideDelayTime) ? hideDelayTime : "0"), 71 72 topPositionFirstPriority: @((!string.IsNullOrEmpty(positionPriority) && positionPriority != "width") ? "true" : "false"), 73 orientation: { 74 @{ 75 string verticalPosition = Model.Area.Item.GetString("Cookie_Vertical_Position"); 76 string minTopOffset = Model.Area.Item.GetString("Cookie_Minimum_Top_Offset"); 77 string marginTopPercentage = Model.Area.Item.GetString("Cookie_Margin_Top_Percentage"); 78 } 79 position: '@(!string.IsNullOrEmpty(verticalPosition) ? verticalPosition : "bottom")', 80 minOffSet: @(!string.IsNullOrEmpty(minTopOffset) ? minTopOffset : "150"), 81 percentage: @(!string.IsNullOrEmpty(marginTopPercentage) ? marginTopPercentage : "0"), 82 @{ 83 var autoAdjustTop = Model.Area.Item.GetString("Cookie_Auto_Adjust_Top_Position"); 84 if(!string.IsNullOrEmpty(autoAdjustTop) && !string.Equals(autoAdjustTop, "False", StringComparison.CurrentCultureIgnoreCase)) 85 { 86 @: topAuto: true 87 } else { 88 @: topAuto: false 89 } 90 } 91 }, 92 text: { 93 @{ 94 string topHeadline = Model.Area.Item.GetString("Cookie_Text_Top_Headline"); 95 string topContent = Model.Area.Item.GetString("Cookie_Text_Top_Content"); 96 string bottomHeadline = Model.Area.Item.GetString("Cookie_Text_Bottom_Headline"); 97 string bottomContent = Model.Area.Item.GetString("Cookie_Text_Bottom_Content"); 98 string bottomLink = Model.Area.Item.GetString("Cookie_More_Info_Link_Text"); 99 100 @: top:{ 101 @: headline: '@(!string.IsNullOrEmpty(topHeadline) ? topHeadline : "Information")', 102 @: content: '@(!string.IsNullOrEmpty(topContent) ? topContent : "Om brug af cookies")' 103 @: }, 104 105 @: bottom: { 106 @: headline: '@(!string.IsNullOrEmpty(bottomHeadline) ? bottomHeadline : "Hjemmesiden bruger cookies")', 107 @: content: '@(!string.IsNullOrEmpty(bottomContent) ? bottomContent : "Dette website anvender cookies til f&oslash;lgende form&aring;l:<br/><br/>"+ 108 "Teknisk funktionalitet s&aring; vi kan huske dine pr&aelig;ferencer.<br /><br/>"+ 109 "Trafikm&aring;ling s&aring; vi ved, hvor mange der bes&oslash;ger vores hjemmeside, og dermed kan dokumentere dette overfor fx annonc&oslash;rer.<br />"+ 110 "<br />Cookies er en fil, som l&aelig;gges p&aring; din computer eller andet IT udstyr. Den g&oslash;r det muligt at genkende din computer og samle information om hvilke sider og funktioner der bes&oslash;ges med din browser. Men cookies kan ikke se, hvem du er, hvad du hedder, hvor du bor eller om computeren bruges af en eller flere personer. Den kan heller ikke sprede computervirus eller andre skadelige programmer."+ 111 "<br /><br/>"+ 112 "<b>Hvis du klikker videre p&aring; siden, accepterer du vores brug af cookies.</b>"+ 113 "<br />"+ 114 "<br />"+ 115 "Vil du vide mere om vores cookies, og hvordan du sletter dem, ")', 116 @: link: '@(!string.IsNullOrEmpty(bottomLink) ? bottomLink : "klik her")' 117 @: } 118 } 119 }, 120 css: { 121 headline: { 122 @{ 123 string headlineColor = Model.Area.Item.GetString("Cookie_Css_Headline_Color"); 124 string headlineLineHeight = Model.Area.Item.GetString("Cookie_Css_Headline_LineHeight"); 125 string headlineFontSize = Model.Area.Item.GetString("Cookie_Css_Headline_FontSize"); 126 string headlineFontWeight = Model.Area.Item.GetString("Cookie_Css_Headline_FontWeight"); 127 string headlineTextTransform = Model.Area.Item.GetString("Cookie_Css_Headline_TextTransform"); 128 @: color: '@(!string.IsNullOrEmpty(headlineColor) ? headlineColor : "#000000")', 129 @: lineHeight: '@(!string.IsNullOrEmpty(headlineLineHeight) ? headlineLineHeight : "14px")', 130 @: fontSize: '@(!string.IsNullOrEmpty(headlineFontSize) ? headlineFontSize : "12px")', 131 @: fontWeight: '@(!string.IsNullOrEmpty(headlineFontWeight) ? headlineFontWeight : "bold")', 132 @: textTransform: '@(!string.IsNullOrEmpty(headlineTextTransform) ? headlineTextTransform : "uppercase")' 133 } 134 }, 135 content: { 136 @{ 137 string contentColor = Model.Area.Item.GetString("Cookie_Css_Content_Color"); 138 string contentLineHeight = Model.Area.Item.GetString("Cookie_Css_Content_LineHeight"); 139 string contentFontSize = Model.Area.Item.GetString("Cookie_Css_Content_FontSize"); 140 string contentFontWeight = Model.Area.Item.GetString("Cookie_Css_Content_FontWeight"); 141 @: color: '@(!string.IsNullOrEmpty(contentColor) ? contentColor : "#000000")', 142 @: lineHeight: '@(!string.IsNullOrEmpty(contentLineHeight) ? contentLineHeight : "14px")', 143 @: fontSize: '@(!string.IsNullOrEmpty(contentFontSize) ? contentFontSize : "12px")', 144 @: fontWeight: '@(!string.IsNullOrEmpty(contentFontWeight) ? contentFontWeight : "normal")' 145 } 146 }, 147 @{ 148 string cssFontFamily = Model.Area.Item.GetString("Cookie_Css_FontFamily"); 149 string cssColor = Model.Area.Item.GetString("Cookie_Css_Color"); 150 string cssBackgroundColor = Model.Area.Item.GetString("Cookie_Css_BackgroundColor"); 151 string cssBorderRadius = Model.Area.Item.GetString("Cookie_Css_BorderRadius"); 152 string cssWidth = Model.Area.Item.GetString("Cookie_Css_Width"); 153 string autoAdjustWidth = Model.Area.Item.GetString("Cookie_Auto_Adjust_Width"); 154 string cssLinkColor = Model.Area.Item.GetString("Cookie_Css_LinkColor"); 155 156 @: fontFamily: '@(!string.IsNullOrEmpty(cssFontFamily) ? cssFontFamily : "Arial,Sans-Serif")', 157 @: border: '@(!string.IsNullOrEmpty(cssColor) ? cssColor : "3px solid #45ABD7")', 158 @: backgroundColor: '@(!string.IsNullOrEmpty(cssBackgroundColor) ? cssBackgroundColor : "#FFFFFF")', 159 @: borderRadius: '@(!string.IsNullOrEmpty(cssBorderRadius) ? cssBorderRadius : "10px")', 160 @: width: '@(!string.IsNullOrEmpty(cssWidth) ? cssWidth : "230px")', 161 @: widthAuto: @((!string.IsNullOrEmpty(autoAdjustWidth) && !string.Equals(autoAdjustWidth, "False", StringComparison.CurrentCultureIgnoreCase)) ? "true" : "false"), 162 @: linkColor: '@(!string.IsNullOrEmpty(cssLinkColor) ? cssLinkColor : "#0026FF")' 163 } 164 }, 165 seen: false 166 }); 167 }); 168 </script> 169 } 170 @SnippetEnd("CookieNotice") 171 172 @{ 173 var url = HttpContext.Current.Request.Url.ToString(); 174 175 if(url.IndexOf("©") > -1) { 176 url = url.Replace("©", "&copy"); 177 178 HttpContext.Current.Response.Redirect(url); 179 HttpContext.Current.Response.End(); 180 return; 181 } 182 string designBasePath = Pageview.Layout.File.Location; 183 184 //<ul class="dwnavigation" id="serviceMenu" settings="endlevel:1;parenttag:topbarnav;"></ul> 185 var servicemenu = RenderNavigation(new { 186 id = "serviceMenu", 187 parenttag = "topbarnav", 188 endlevel = 1 189 }); 190 191 //<ul class="dwnavigation nav navbar-nav" id="topmenu" settings="startlevel:1;endlevel:2;expandmode:all;template:mainmenu.xslt"></ul> 192 var topmenu = RenderNavigation(new { 193 id = "topmenu", 194 startLevel = 1, 195 expandmode = "all", 196 endlevel = 2, 197 template = "mainmenu.xslt" 198 }); 199 200 //<ul class="dwnavigation" id="sitemap-footer" settings="startlevel:0;endlevel:3;expandmode:all;template:footer.xslt;"></ul> 201 var sitemapfooter = RenderNavigation(new { 202 id = "sitemap-footer", 203 startLevel = 0, 204 expandmode = "all", 205 endlevel = 3, 206 template = "footer.xslt" 207 }); 208 } 209 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 210 <!--[if lt IE 7]> <html lang="en-us" class="no-js lt-ie11 lt-ie10 ie6 lt-ie9 lt-ie8 lt-ie7 oldie"> <![endif]--> 211 <!--[if IE 7]> <html lang="en-us" class="no-js lt-ie11 lt-ie10 ie7 lt-ie9 lt-ie8 oldie"> <![endif]--> 212 <!--[if IE 8]> <html lang="en-us" class="no-js ie8 lt-ie11 lt-ie10 lt-ie9 oldie"> <![endif]--> 213 <!--[if IE 9]> <html lang="en-us" class="no-js ie9 lt-ie11 lt-ie10 oldie"> <![endif]--> 214 <!--[if IE 10]> <html lang="en-us" class="no-js ie10 lt-ie11"> <![endif]--> 215 <!--[if gt IE 10]><!--> 216 <html lang="en-us" class="no-js"> 217 <!--<![endif]--> 218 <head> 219 <meta charset="utf-8" /> 220 <!--meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"--> 221 <title>@Model.Title</title> 222 <meta name="robots" content="index, follow" /> 223 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 224 @Model.MetaTags 225 226 <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" /> 227 <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> 228 229 <link href="@designBasePath/css/style.css" rel="stylesheet" /> 230 <link href="@designBasePath/css/jquery.bxslider.css" rel="stylesheet" /> 231 232 @RenderSnippet("Icons") 233 <!--Loading some needed scripts at top of page - rest before end of body tag--> 234 <!--[if lt IE 9]> 235 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 236 <![endif]--> 237 <!--[if gte IE 9]><!--> 238 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> 239 <!--<![endif]--> 240 <!--[if lt IE 9]> 241 <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script> 242 <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script> 243 <![endif]--> 244 </head> 245 <body> 246 <div id="topWrapper"> 247 <div id="top" class="siteWrapped"> 248 <div class="logo"></div> 249 <script type="text/javascript"> 250 $('.logo').click(function () { location.href = '/Default.aspx?id=1'; }); 251 </script> 252 <div id="serviceMenuWrapper"> 253 <div id="serviceMenu"> 254 @servicemenu 255 </div> 256 </div> 257 </div> 258 259 <!--NavBar--> 260 <div id="blackMenu"> 261 <div id="menuWrapper" class="container siteWrapped"> 262 <!-- Static navbar --> 263 <div class="navbar navbar-default" id="menu"> 264 <div class="navbar-header"> 265 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> 266 <span class="icon-bar"></span> 267 <span class="icon-bar"></span> 268 <span class="icon-bar"></span> 269 </button> 270 </div> 271 <div class="navbar-collapse collapse"> 272 @topmenu 273 <div id="search"> 274 <form method="get" action="/Default.aspx"> 275 <input type="hidden" name="ID" value="7" /> 276 <input type="text" name="q" placeholder="S&oslash;g" /> 277 <input type="submit" class="searchSubmit btn" value="" /> 278 </form> 279 </div> 280 </div> 281 </div> 282 </div> 283 </div> 284 </div> 285 286 <div id="siteWrapper" class="siteWrapped"> 287 <div id="contentWrapper"> 288 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 289 290 @using System.Data.SqlClient 291 @using System.Text 292 @functions { 293 public class Ansoegningsblanket { 294 public int id { get; set; } 295 public string navn { get; set; } 296 public string bopael { get; set; } 297 public string postnummer { get; set; } 298 public string by { get; set; } 299 public string telefonnummer { get; set; } 300 public string mobiltelefonnummer { get; set; } 301 public string email { get; set; } 302 public string cprnummer { get; set; } 303 public string fil { get; set; } 304 public string anbefaler { get; set; } 305 public DateTime anbefaler_dato { get; set; } 306 public string kommentar { get; set; } 307 public DateTime _dato { get; set; } 308 public string _ip { get; set; } 309 public string _browser { get; set; } 310 public string _data { get; set; } 311 312 public static Ansoegningsblanket LoadBlanket(int rowId) { 313 return LoadBlanket("2016", rowId); 314 } 315 316 public static Ansoegningsblanket LoadBlanket(string suffix, int rowId) { 317 using (var connection = Dynamicweb.Data.Database.CreateConnection()) { 318 using (var command = connection.CreateCommand()) { 319 command.CommandText = "SELECT * FROM Ansoegningsblanket_" + suffix + " WHERE Ansoegningsblanket_" + suffix + "ID = @id"; 320 321 command.Parameters.Add(new SqlParameter("@id", rowId)); 322 323 using (var reader = command.ExecuteReader()) { 324 if (reader.Read()) { 325 return new Ansoegningsblanket { 326 id = reader.GetInt32(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "ID")), 327 navn = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Navn")), 328 bopael = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Bopael")), 329 postnummer = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Postnummer")), 330 by = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_By")), 331 telefonnummer = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Telefonnummer")), 332 mobiltelefonnummer = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Mobiltelefonnummer")), 333 email = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Email")), 334 cprnummer = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_CPRnummer")), 335 fil = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Fil")), 336 anbefaler = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Anbefaler")), 337 anbefaler_dato = reader.IsDBNull(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Anbefaler_Dato")) ? DateTime.MinValue : reader.GetDateTime(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Anbefaler_Dato")), 338 kommentar = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "_Kommentar")), 339 _dato = reader.GetDateTime(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "__Dato")), 340 _ip = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "__IP")), 341 _browser = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "__Browser")), 342 _data = reader.GetString(reader.GetOrdinal("Ansoegningsblanket_" + suffix + "__Data")) 343 }; 344 } 345 } 346 } 347 } 348 349 return null; 350 } 351 352 private static int[] XorKeys { 353 get { 354 return new[] { 210, 184, 99, 118, 57, 160, 85, 172, 21, 155, 114, 183, 208, 102, 176, 49 }; 355 } 356 } 357 358 private static string BytesToHex(byte[] bytes) { 359 var c = new char[bytes.Length * 2]; 360 361 for (var i = 0; i < bytes.Length; i++) { 362 var b = (byte)(bytes[i] >> 4); 363 c[i * 2] = (char)(b > 9 ? b + 0x37 + 0x20 : b + 0x30); 364 b = (byte)(bytes[i] & 0xF); 365 c[i * 2 + 1] = (char)(b > 9 ? b + 0x37 + 0x20 : b + 0x30); 366 } 367 368 return new string(c); 369 } 370 371 private static byte[] HexToBytes(string hex) { 372 var bytes = new byte[hex.Length / 2]; 373 374 for (var i = 0; i < bytes.Length; i++) { 375 var c = hex[i * 2]; 376 bytes[i] = (byte)((c > '9' ? (c > 'Z' ? (c - 'a' + 10) : (c - 'A' + 10)) : (c - '0')) << 4); 377 c = hex[i * 2 + 1]; 378 bytes[i] |= (byte)(c > '9' ? (c > 'Z' ? (c - 'a' + 10) : (c - 'A' + 10)) : (c - '0')); 379 } 380 381 return bytes; 382 } 383 384 public static string XorEncrypt(string value) 385 { 386 var buffer = Encoding.UTF8.GetBytes(value); 387 var hashed = new byte[buffer.Length + 16]; 388 var keys = XorKeys; 389 var salt = (Guid.NewGuid()).ToByteArray(); 390 var j = 0; 391 392 for (var i = 0; i < 8; i++) { 393 hashed[i] = (byte)(salt[i] ^ (uint)keys[i]); 394 hashed[i + 8 + buffer.Length] = (byte)(salt[i + 8] ^ (uint)keys[i + 8]); 395 } 396 397 for (var i = 0; i < buffer.Length; i++) { 398 if (j >= 16) 399 j = 0; 400 hashed[i + 8] = (byte)((buffer[i] ^ (uint)salt[j]) ^ 135u); 401 j++; 402 } 403 404 return BytesToHex(hashed); 405 } 406 407 public static string XorDecrypt(string value) { 408 var hashed = HexToBytes(value); 409 var buffer = new byte[hashed.Length - 16]; 410 var keys = XorKeys; 411 var salt = new byte[16]; 412 var j = 0; 413 414 for (var i = 0; i < 8; i++) { 415 salt[i] = (byte)(hashed[i] ^ (uint)keys[i]); 416 salt[i + 8] = (byte)(hashed[i + 8 + buffer.Length] ^ (uint)keys[i + 8]); 417 } 418 419 for (var i = 0; i < buffer.Length; i++) { 420 if (j >= 16) 421 j = 0; 422 buffer[i] = (byte)((hashed[i + 8] ^ 135u) ^ salt[j]); 423 j++; 424 } 425 426 return Encoding.UTF8.GetString(buffer); 427 } 428 } 429 } 430 @using System.Web 431 @{ 432 var rowId = Ansoegningsblanket.XorDecrypt(HttpContext.Current.Request.QueryString["rId"]).Split(':')[1]; 433 var blanket = string.IsNullOrWhiteSpace(rowId) ? null : Ansoegningsblanket.LoadBlanket("2016", int.Parse(rowId)); 434 435 var leftnav = RenderNavigation(new { 436 id = "leftnav", 437 startLevel = 2, 438 expandmode = "path", 439 endlevel = 10, 440 template = "LIClean.xslt" 441 }); 442 var breadcrumbnav = RenderNavigation(new { 443 id = "breadcr", 444 startLevel = 1, 445 expandmode = "path", 446 endlevel = 4, 447 template = "Breadcrumb.xslt", 448 sitemapmode = "true" 449 }); 450 } 451 452 <div id="leftColumnWrapper" class="sideColumnWrapper"> 453 <div id="leftColumnHeader" class="leftnav"> 454 <h4>@Model.TopPage.Name</h4> 455 </div> 456 <div class="leftnav"> 457 @leftnav 458 </div> 459 <div id="leftColumn" class="leftColumn"> 460 @Model.Placeholder("leftColumn", "Venstre Menu", "template:/Paragraph/CleanParagraph.cshtml") 461 </div> 462 </div> 463 464 <div id="center3ColumnWrapper" class="centerColumnWrapper"> 465 <div id="breadcrumb"> 466 @breadcrumbnav 467 </div> 468 469 <div id="centerColumn" class="centerColumn"> 470 @Model.Placeholder("centerColumn", "Indhold", "template:/Paragraph/CleanParagraph.cshtml;default:true") 471 </div> 472 473 @if(blanket != null) { 474 var datajson = Newtonsoft.Json.Linq.JObject.Parse(blanket._data); 475 var data_GenerateSend = (string)datajson["_Data_GenerateSend"]["value"]; 476 var cryptId = Ansoegningsblanket.XorEncrypt(DateTime.Now.Ticks + ":" + blanket.id); 477 478 <style type="text/css"> 479 #centerColumn { 480 min-height: auto; 481 } 482 </style> 483 484 if(data_GenerateSend == "PDF") { 485 <h1>Du har valgt at sende fysisk</h1> 486 <p>Tak for udfyldelse af lånansøgningen. Du kan ved klik på nedenstående link, printe eller gemme din låneansøgning. Låneansøgningen sender du efterfølgende pr. brev eller via en e-mail til din kontaktperson.</p> 487 <a href="/Admin/Public/Ansoegningsblanket_2016Handler.ashx?methodName=GetPDF&amp;id=@(cryptId)" class="btn btn-default" role="button" target="_blank">Print/Gem ansøgning</a> 488 } else { 489 <h1>Tak for din ansøgning, som du nu har sendt til din faglige organisation.</h1> 490 <p>Når vi modtager ansøgningen fra din organisation, behandler vi ansøgningen og sender afgørelsen til din mail.</p> 491 <p>Er lånet bevilget sender vi samtidig lånedokumenterne via E-Signatur til din mail og de skal underskrives med din NemID.</p> 492 <p>Såfremt du ikke har NemID kan dokumenterne fremsendes med post. Du skal så kontakte låneforeningens kontor.</p> 493 <p>Lånet kan først udbetales til din NemKonto når vi efterfølgende har fået noteret lånet på dit lønkontor.</p> 494 } 495 } 496 497 @RenderSnippet("SNS") 498 </div> 499 500 <div id="rightColumnWrapper" class="sideColumnWrapper"> 501 <div id="rightColumn" class="rightColumn"> 502 @Model.Placeholder("rightColumn", "Højre Menu", "template:/Paragraph/CleanParagraph.cshtml") 503 </div> 504 </div> 505 @if(false) { 506 //Simply to make it possible to select it in website settings - seems to be a bug either in 9.7 or from upgrading? 507 <div id="ignore" class="dwcontent" title="Ignore"></div> 508 } 509 </div> 510 </div> 511 512 <div id="footerWrapper"> 513 <div id="siteMapWrapper"> 514 <div id="siteMap" class="siteWrapped"> 515 <div class="cols"> 516 @sitemapfooter 517 <div> 518 </div> 519 </div> 520 <div id="footerContentWrapper"> 521 <div id="footerContent" class="siteWrapped"> 522 @RenderParagraphContent(22) 523 </div> 524 </div> 525 </div> 526 527 <!--Scripts placed at the end of the page to make it load faster--> 528 <script src="@designBasePath/javascript/jquery.bxslider.min.js"></script> 529 <script src="@designBasePath/javascript/script.js"></script> 530 <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script> 531 @RenderSnippet("GoogleAnalytics") 532 @RenderSnippet("CookieNotice") 533 534 <script type="text/javascript"> 535 $('#mainmenu.nav > li.dropdown:last-child').append($('<div class="cta"></div>')); 536 </script> 537 </div> 538 </div> 539 </body> 540 </html>