TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Yogesh Vedpathak
669
1.4k
197.7k
not able to make call Post Action Method on Submit button .
Mar 8 2018 5:42 AM
button code
<button type="submit" onclick="location.href='@Url.Action("Login", "Registration", FormMethod.Post)'" class="btn btn-default">Submit</button>
// Code of Get Method
[HttpGet]
public ActionResult Login()
{
return View();
}
// Code Of HttpPost Method
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Login(UserResgitartion objUser)
{
if (ModelState.IsValid)
{
using (MyDatabaseEntities Db = new MyDatabaseEntities())
{
var obj = Db.UserResgitartions.Where(a => a.UserName.Equals(objUser.UserName) && a.Password.Equals(objUser.Password)).FirstOrDefault();
if (obj != null)
{
Session["UserID"] = obj.UserID.ToString();
Session["USERNAME"] = obj.UserName.ToString();
if (objUser.UserName == "Admin" && objUser.Password == "admin")
{
return View("AdminDashBoard");
}
else
{
return View("UserDashBoard");
}
// return RedirectToAction("UserDashBoard");
}
}
}
return View(objUser);
}
public ActionResult UserDashBoard()
{
if (Session["UserID"] != null)
{
return View();
}
else
{
return RedirectToAction("Login");
}
}
Reply
Answers (
2
)
JsonRequestBehavior.AllowGet error in Asp.net Core 2.0
Unable to cast object of type 'iTextSharp.text.html.simplepa