Help me to resolve this issue. after publish on IIS server action method not found while we submit the login form. It's working with when executing on visual studio.
this is the view "Index.cshtml"
- "ModelOnly" class="text-danger">
- class="form-group">
- ="UserName" class="control-label">User Name
- for="UserName" class="form-control" />
- for="UserName" class="text-danger">
- class="form-group">
- ="Password" class="control-label">Password
- for="Password" class="form-control" type="password" />
- for="Password" class="text-danger">
- class="form-group">
- "submit" value="Create" class="btn blue-gradient" />
- namespace DeltaSoftLIS.Controllers
- {
- [Area("Reception")]
- public class LoginController : Controller
- {
- private readonly ApplicationDbContext _db;
- public LoginController(ApplicationDbContext context)
- {
- _db = context;
- }
- public IActionResult Index()
- {
- return View();
- }
- [HttpPost]
- //[Route("/Reception/Login/Index/{username?}/{password}")]
- public IActionResult Index(string ? username, string ? password)
- {
- var userId = _db.logins.Where(p=>p.UserName==username && p.Password==password && p.ExpiryDate> DateTime.Now).Select(p=>p.Id).FirstOrDefault();
- if (userId>0)
- {
- HttpContext.Session.SetString("username", username);
- return Redirect("~/Reception/Home/Index");
- }
- else
- {
- ViewBag.error = "Invalid Login..!";
- return View("Index");
- }
- }
- [HttpGet]
- public IActionResult Logout()
- {
- HttpContext.Session.Remove("username");
- return RedirectToAction("Index");
- }
- }
- }

Sk JhaPosted May 5, 2020, 8:41 PM
Piyush PansuriyaPosted May 5, 2020, 12:53 AM
tilde(~) Sign Before the action URL.