Exception in template (\Designs\AddSecure\Paragraph\AccessDenied.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
at Dynamicweb.Frontend.SearchEngineFriendlyURLs.ResolveQueryString(String fullQueryString, Int32 pageid, String alternatekey)
at Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Int32 pageID, String alternatekey)
at CompiledRazorTemplates.Dynamic.badaefaadfec.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()
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
@using System.Web
@using Dynamicweb.Content
@{
// I pulled a quickie and copied this format from login.cshtlm
string pageId = GetGlobalValue("Global:Page.ID");
var isSweden = false;
var signoutid = 0;
var homeid = 0;
// This switch is reversed due to the fact that i this rare scenario, new Area().Culture is the opposite of user origin
switch (new Area().Culture)
{
case "sv-SE":
signoutid = 36;
homeid = 28;
isSweden = false;
break;
case "en-GB":
signoutid = 56;
homeid = 48;
isSweden = false;
break;
case "nb-NO":
signoutid = 9;
homeid = 1;
isSweden = true;
break;
case "en-US":
signoutid = 46;
homeid = 38;
isSweden = true;
break;
}
// swe = 9, sweeng = 46, nor = 36, noreng = 56
string signoutUrl = "/Admin/Public/ExtranetLogoff.aspx?ID=" + signoutid;
// swe = 1, sweeng = 38, nor = 28, noreng = 48
string homeUrl = AddSecure.DW.Helpers.Extensions.GetUrl(homeid);
}
<div class="login-background">
<div class="grid grid--justify-center">
<div class="grid__col-md-6 login-box" style="padding: 40px 70px 40px 70px !important;max-width: 500px;min-width: 450px;">
<img class="login-logo" src="~/Files/Templates/Designs/AddSecure/Images/AddSecureLogo.png" />
<b class="login-header">@Translate("Access denied", "Åtkomst nekad")</b>
@if (isSweden)
{
<p style="text-align: left;">@Translate("You do not have the correct permissions to view this page. It is possible that you have entered the Norwegian AddSecure shop with a Swedish account", "Du har inte behörighet at se denna sida. Det är möjligt att du har råkat hamna på norska AddSecure med ett svenskt konto").</p>
}
else
{
<p style="text-align: left;">@Translate("You do not have the correct permissions to view this page. It is possible that you have entered the Swedish AddSecure shop with a Norwegian account", "Du har inte behörighet at se denna sida. Det är möjligt att du har råkat hamna på svenska AddSecure med ett norskt konto").</p>
}
<div class="row margin-bottom-15 buttons" style="text-align: center !important;">
<div class="col-lg-12" style="text-align: center;">
<button type="button" class="inline-block btn btn--secondary" onclick="logout();" style="padding: 5px 30px;">@Translate("Sign out", "Logga ut")</button>
<button type="submit" class="btn btn--primary inline-block" onclick="home();" style="margin-left: 5px;padding: 5px 30px;">@Translate("Go to home page", "Gå till startsidan")</button>
</div>
</div>
</div>
</div>
</div>
<script>
function logout() {
window.location.href = "@signoutUrl";
}
function home() {
window.location.href = "@homeUrl";
}
</script>