1 minute read
I’ve posted on similar tricks to this in the past, but this little trick is really helpful and worth calling out on its own. Say that you’d like to pass a Source parameter on the query String, as SharePoint often does for you:
Simple, and you see it all the time as you navigate around in SharePoint. In many cases, you’d also like to pass additional parameters that will “travel along” with the Source parameter. The trick for this is to simply encode the ampersand (&) character so that it won’t be treated as the start of a new Query String parameter, but instead just a part of the Source parameter. The ASCII value for the ampersand is 26 in hex, so you encode it as %26 in the URL:
Note that I’m passing in the relative URL for the default.aspx page. Get into the habit of using relative URLs all the time and you’ll be in much better shape in general.
With the above URL, when you are finished with the EditForm.aspx page, whether by clicking OK or Cancel, you’ll be redirected to: