0
I developed a project on Asp.net mvc5 of a course I’m doing, which is accusing the following error of exception when authenticating the login menu when I enter no data in the form fields and step null parameters:
"An Exception of type 'System.Argumentexception' occurred in Webmatrix.WebData.dll but was not handled in user code - Additional information: Value cannot be null or an Empty string"
I believe that the problem is with simplemembership, because in the other views of forms when I authenticate with null values does not happen this error of exception, being that the controller of the login menu was configured with simplemenbership. I would like to know how to configure simplemembership not to give this exception error when authenticating with null values. Below is the screen print and logincontroller code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebMatrix.WebData;
namespace Financas.Controllers
{
public class LoginController : Controller
{
// GET: Login
public ActionResult Index()
{
return View();
}
public ActionResult Autentica(string login, string senha )
{
if (WebSecurity.Login(login, senha))
{
return RedirectToAction("Index", "Movimentacao");
}
else
{
ModelState.AddModelError("Login.Invalido", "Login ou senha incorretos");
return View("Index");
}
}
public ActionResult Logout()
{
WebSecurity.Logout();
return RedirectToAction("Index");
}
}
}
I modified it and it worked right here in my project, thank you.
– Leonardo Gustavo Maran