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
tri_inn
NA
1.2k
232.4k
ASP.Net MVC: regarding RedirectToAction function
Jun 2 2017 7:26 AM
suppose i have two action in controller called login
public
ActionResult Login()
{
return
View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public
ActionResult Login(UserProfile objUser)
{
if
(ModelState.IsValid)
{
using
(DB_Entities db =
new
DB_Entities())
{
var obj = db.UserProfiles.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();
return
RedirectToAction(
"UserDashBoard"
);
}
}
}
return
View(objUser);
}
when we write
return RedirectToAction(
"Login"
);
then how asp.net mvc understand that we are thinking about login function which uisng get http verb login not post
http verb
login ?
anyone can explian it ?
how we can redirect to action which is based on post http verb ?
what will be the syntax if we need to redirect to action with http verb if we use
RedirectToAction
function ?
thanks
Reply
Answers (
2
)
ASP.NET Core: Data Grid - Problem with Update Operation
saving multiple data into ms-sql at once using asp.net