Error executing template "Designs/Swift/UserManagement/Login/Login_Custom.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_98cd63a6614544bf943f360161f18a46.Execute() in D:\dynamicweb.net\Solutions\brdklee.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\UserManagement\Login\Login_Custom.cshtml:line 58
   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.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb 3 @using Dynamicweb.Environment 4 5 @{ 6 string pageTitle = Pageview.Page.GetDisplayName(); 7 string pageId = GetGlobalValue("Global:Page.ID"); 8 int signInProfilePageId = Pageview.Page.ID; 9 string currentUserId = GetGlobalValue("Global:Extranet.UserID"); 10 string goBackToPage = Dynamicweb.Context.Current.Request.GetString("GoBackToPage"); //parameter from anonymous checkout 11 string absoluteUri = Dynamicweb.Context.Current?.Request?.UrlReferrer?.AbsoluteUri != null ? Dynamicweb.Context.Current.Request.UrlReferrer.AbsoluteUri : ""; 12 string redirectPage = !string.IsNullOrEmpty(goBackToPage) ? "Default.aspx?Id=" + goBackToPage : absoluteUri; 13 redirectPage = string.IsNullOrEmpty(goBackToPage) && !string.IsNullOrEmpty(GetString("UserManagement:User.Login.SuccessRedirectToPage")) ? GetString("UserManagement:User.Login.SuccessRedirectToPage") : redirectPage; 14 15 string createAccountPageLink = Pageview.CurrentParagraph.Item["CreateAccountPage"] != null ? Pageview.CurrentParagraph.Item["CreateAccountPage"].ToString() : ""; 16 17 string contentPadding = Pageview.CurrentParagraph.Item["ContentPadding"] != null ? Pageview.CurrentParagraph.Item["ContentPadding"].ToString() : ""; 18 contentPadding = contentPadding == "none" ? "px-0" : contentPadding; 19 contentPadding = contentPadding == "small" ? "p-2 p-md-3" : contentPadding; 20 contentPadding = contentPadding == "large" ? "p-4 p-md-5" : contentPadding; 21 var themeRaw = Pageview.CurrentParagraph.Item["Theme"]?.ToString(); 22 string theme = !string.IsNullOrEmpty(themeRaw) ? " theme " + themeRaw.Replace(" ", "").Trim().ToLower() : " theme light"; 23 24 var loginProvider = GetLoop("DWExtranetExternalLoginProviders"); 25 26 //CUSTOM CODE 27 var UrlReferrer = Dynamicweb.Context.Current.Request.UrlReferrer; 28 } 29 30 31 <div class="@(contentPadding)"> 32 @if (!string.IsNullOrEmpty(GetString("DW_extranet_error_uk"))) 33 { 34 <div class="alert alert-danger" role="alert"> 35 @GetString("DW_extranet_error_uk") 36 </div> 37 } 38 39 <div class="card border-0@(theme) mx-auto" style="max-width: 30rem;"> 40 41 <div class="card-header text-center p-4 border-bottom"> 42 <h4 class="display-6 m-0">@pageTitle</h4> 43 @if (!string.IsNullOrEmpty(createAccountPageLink)) 44 { 45 <p class="card-text mt-2">@Translate("Don't have an account yet?") <a href="@createAccountPageLink">@Translate("Create account here")</a></p> 46 } 47 </div> 48 49 <div class="card-body p-4"> 50 <form class="grid grid-1 gap-4" method="post"> 51 <input type="hidden" name="ID" value="@pageId"> 52 <input type="hidden" name="DWExtranetUsernameRemember" value="True"> 53 <input type="hidden" name="DWExtranetPasswordRemember" value="True"> 54 <input type="hidden" name="GoBackToPage" value="@goBackToPage"> 55 <input type="hidden" name="LoginAction" value="Login"> 56 57 @*CUSTOM CODE*@ 58 @if (UrlReferrer.ToString() != redirectPage) 59 { 60 <input type="hidden" name="redirect" value="@UrlReferrer"> 61 } 62 else if (!Convert.ToBoolean(Pageview.CurrentParagraph.Item["EnableUserStartPageRedirect"])) 63 { 64 <input type="hidden" name="redirect" value="@redirectPage"> 65 } 66 67 @foreach (LoopItem provider in loginProvider) 68 { 69 string iconPath = "/Files/IconsLoginProviders/"; 70 string providerName = provider.GetString("ProviderName").ToLower(); 71 string providerIcon = string.Empty; 72 73 if (providerName.Contains("azure")) 74 { 75 providerIcon = "azure"; 76 } 77 if (providerName.Contains("google")) 78 { 79 providerIcon = "google"; 80 } 81 82 <div class="d-grid"> 83 <a class="btn btn-primary-outline btn-lg" href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@provider.GetValue("ProviderID")"> 84 <span class="d-flex justify-content-center align-items-center"> 85 <span class="icon-3 me-2"> 86 @ReadFile(iconPath + providerIcon + ".svg") 87 </span> 88 <span>@Translate("Sign in with") @provider.GetString("ProviderName")</span> 89 </span> 90 </a> 91 </div> 92 93 <div class="d-flex align-items-center gap-3"> 94 <span class="border-top flex-fill"></span> 95 <span class="text-uppercase">@Translate("or")</span> 96 <span class="border-top flex-fill"></span> 97 </div> 98 } 99 100 <div> 101 <div class="form-label fs-7 mb-0 opacity-75">@Translate("Your email")</div> 102 <div class="form-floating"> 103 <input type="text" class="form-control" id="login-username" name="username" placeholder="@Translate("Email")" required> 104 <label for="login-username">@Translate("Email")</label> 105 </div> 106 107 </div> 108 109 <div> 110 <div class="d-flex justify-content-between align-items-center"> 111 <div class="form-label fs-7 mb-0 opacity-75">@Translate("Your password")</div> 112 <a tabindex="-1" class="form-label-link" href="/Default.aspx?id=@(signInProfilePageId)&LoginAction=Recovery" id="ForgotPasswordButton">@Translate("Forgot password?")</a> 113 </div> 114 115 <div class="form-floating"> 116 <input type="password" class="form-control" id="LoginPassword" name="password" placeholder="@Translate("Password")" required> 117 <label for="login-password">@Translate("Password")</label> 118 </div> 119 </div> 120 121 <div class="form-check"> 122 <input class="form-check-input" type="checkbox" value="True" name="Autologin" id="RememberMe"> 123 <label class="form-check-label" for="RememberMe">@Translate("Keep me signed in")</label> 124 </div> 125 126 <div class="d-grid"> 127 <button type="submit" class="btn btn-primary btn-lg" id="SignInButton">@Translate("Sign in")</button> 128 </div> 129 </form> 130 </div> 131 </div> 132 </div> 133
Ved at klikke 'Acceptér Alle' så giver du til tilladelse til at vi må indsamle information om dig til forskellige formål, hvilket inkluderer: Funktionalitet, Statistik og Marketing