Instead of return View()
, You need to use return RedirectToAction
or return Redirect
method.
You may get the previous page in your login action using different methods
1) pass the current pages url to login action method as a parameter and use that for redirecting after successful authentication
2)Use the Request object to get the UrlReferrer property value and use that as the page to be redirected.
Chek this blog post where they explains how they did it in nerddinner.