Almost every time I run my MVC app, it stops with errors before getting to the home page.
UPDATE: Here's the latest code:
public class RequireLoggedIn : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (Membership.GetUser() == null)
{
filterContext.Result = new RedirectResult("~/Logon");
}
}
}
public ActionResult Index()
{
MembershipUser myObject = Membership.GetUser();
Guid UserID = (Guid)myObject.ProviderUserKey;
DateTime dateTime = new DateTime();
dateTime = DateTime.Now.AddDays(14);
var model = db.Task.Where(n => (n.UserId == UserID) && (n.Completed == false) && (n.Due < dateTime));
return View(model);
}
Why is it doing this? It has worked fine in the past.
Any help is much appreciated.