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?



This can be done by specifying a Return URL in the form URL by providing a value to Source querystring. For example:


Here when a user clicks on OK button in Announcements New form, the user is redirected to deafult.aspx page rather than the AllItems.aspx page of the Announcements list. More information here: http://blogs.msdn.com/b/alexma/archive/2006/06/17/635346.aspx?Redirected=true

|improve this answer|||||
  • Thank you for the good start...but how can I tell my login.aspx page to reference the previous page's URL so that can be automatically set as source? – klewis Jan 27 '14 at 11:32
  • When redirecting the user to a login page, append the current page's url in Source query string. – Nadeem Yousuf Jan 27 '14 at 12:16
  • Specifically where is the authentication being handled in SharePoint 2010, when users attempt to log-in? – klewis Feb 26 '14 at 22:10
  • Have a look at HttpModules, see this link for more info: thedotnotcorner.com/2012/06/07/… – Nadeem Yousuf Feb 27 '14 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.