Let's say I have a page called subpage.aspx that my web site visitor is viewing. On that same page is the option link to log into the site. That link will take the user to a page called login.aspx, which will have a login form, allowing users to put in their proper credentials to log-in. When that visitor clicks submit and is authenticated, I want him/her to go back to subpage.aspx because that was the last page they were on before they landed on login.aspx.
Is this possible in SharePoint 2010 or 2013? If so, what are some easy options for doing something like this, that won't break my system?