“Sorry, something went wrong” error message when you sign in as a different user

I have enabled the function of “Sign in as a different user” by the method in the article Here. with the SharePoint build number is 15.0.4481.1005.

After a close review, I found that this error is related to URLs with space character.  If we can remove the space character from the URL, for instance, that for a subsite name, or a document library’s name, or a list’s name, or the landing page’s name, the error would disppear.

It turns out that the query string in the “re-sign-in” URL, in the format of below, contains a value of encoded URL of the current location,

closeConnection.aspx?loginasanotheruser=true&Source=[URLEncodedString]

If this URL contains a space character, it would be double encoded, from ” ” to “%20”, then to “%2520”.

When the URL is incorrectly encoded, SharePoint is unable to send the user to the right URL after user login successfully.  Therefore, an error message of “Sorry, Something went wrong” would be returned.

The URL double encode error has been identified in other part of the SharePoint, for example, in the search result screen.  It has been fixed in April 2014 CU.

However, this double encode error in the “Sign in as a different user” has not been addressed therefore has not been fixed yet.  I am reporting this error and hope MicroSoft can fix this simple error soon.

 

You might not encounter the issue but if you still try installing /patching up to April 2014 CU. Still no luck ? we it obviously have the workaround.

The workaround I am using right now is adding a statement like below at line 31 of closeConnection.aspx file:

if (pageUrl.match(/%2520/)) pageUrl = pageUrl.replace(/%2520/g, “%20”);

This will temporarily restore any double encoded string “%25” back to “%” in the event of “%2520”.  But I think the solution should be provided at the source code where the double encoded URL is generated.  I think SharePoint developers should have a better idea where is the source code.

Remeber to backup your closeconnection.aspx before you start modifying any

Leave a Reply

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