Can anyone tell me why I'm getting a YSOD from the following code? It's only happening when I click the "Logout" button.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Umbraco.Web
@using Umbraco.Web.Controllers
@if (Members.IsLoggedIn())
{
<p>You are currently logged in as <strong>@HttpContext.Current.User.Identity.Name</strong></p>
using (Html.BeginUmbracoForm<UmbLoginStatusController>("HandleLogout"))
{
<fieldset>
<legend>Logout</legend>
<button>Logout</button>
</fieldset>
}
}
else
{
<p>You are not logged in.</p>
}
7.1.3 - I'm using the "snippets" from the macro section, so it's using the UmbLoginStatusController which is already in Core. That means it's using this code;
"HandleLogout" gives me a YSOD
Can anyone tell me why I'm getting a YSOD from the following code? It's only happening when I click the "Logout" button.
Clicking the "Logout" button
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Hi Bear
What does your code for logging members out look like?
And what version of Umbraco are you using?
/Jan
Hi Jan,
7.1.3 - I'm using the "snippets" from the macro section, so it's using the UmbLoginStatusController which is already in Core. That means it's using this code;
https://github.com/umbraco/Umbraco-CMS/blob/7.1.4/src/Umbraco.Web/Controllers/UmbLoginStatusController.cs
I'm very aware of how to roll my own, but I wanted to see if I could just get this working "out-of-the-box" so a designer could just cut and paste.
Hi Bear
Aaah ok - Hmm, not sure wether that's actually a bug or not to be honest. Have not yet had the time to play around with these myself yet.
I guess it could not hurt to file it on the issue tracker
/Jan
Hi guys,
I just ran into the same problem, and it seems the model is not bound (hence the null reference exception).
As a simple workaround you can just create a PostRedirectModel in the view, and make sure it is bound to the form context.
is working on a reply...