1. Add in the Load of the Login.aspx page
if (!IsPostBack && Request.UrlReferrer != null)
{
Session[ "url"] = Request.UrlReferrer;
}
2. Add in the login button event
if (Session["url"] != null)
{
Response.Redirect(System.Web.HttpUtility.UrlDecode(Session["url"].ToString()));//Redirect to the pre-login page
}