Skip to main content

Cloud

Redirecting to the right SharePoint page following UAG authentication

Here’s the scenario:
  • You publish SharePoint content using UAG
  • Users want to share links via email/IM
  • When the recipient clicks your link, they’re prompted to log in
  • After authenticating, they’re redirected to your SharePoint homepage instead of the original link

The reason for this is that UAG only has one <FORM/> action target that is set to your homepage.
The good news is that UAG keeps your original link in its ‘orig_url‘ parameter. We can use Javascript in SharePoint to look at the referring URL and redirect automatically.
To do so, simply add this Javascript to the <HEAD/> of your master page:

<script>

var origURLPos = document.referrer.indexOf(‘&orig_url=’);

if (origURLPos > -1){

var url = unescape(document.referrer.substr(origURLPos + 10));

location.replace(url);

}

</script>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Bert Johnson

More from this Author

Follow Us