If you realize in SharePoint 2010, when you click on username, there is a menu called Sign in as Different User which allows you to use another user to login to the page that you're in directly.
It seems to work pretty well under Microsoft SharePoint 2010 engine. And when you migrate your site from SharePoint 2010 into SharePoint 2013 without performing visual upgrade, your SharePoint site visually will probably look the same, won't it?
But once you finished migrating your site from SharePoint 2010 into SharePoint 2013 and you want to check this feature, has it occurred to you (lets say you're on the list page) that in some particular page when you click this menu "Sign in as Different User", after you login using different username, the page shows you an error page like the screenshot here:
Or in some cases, the error page shows like this:
I am not really sure if this is a bug from the SharePoint or not, but if you realize that this occurred because of the double encode that happens if your page/list/document contains a space in the name. Based on my situation here, I am in the middle of accessing the list named "My First List" which contains a blank space in between.
And if you look at the URL displayed inside the browser, the blank spaces between the word in the list name are replaced with %20. So when I open the list called My First List, the URL will show you the name like: My%20First%20List%20. And what if you try to sign in as a different user from the list that contains a blank space inside its name like the one I have here???
The answer will go like the image below here:
 |
| Step 1. click the menu |
 |
Step 2. Login with another username
|
 |
| Step 3. Here we go... |
You might wonder what actually went wrong in this page. If you take a closer look towards the URL, it shows you different URL format with the one before you sign in as a different user.
You can see from the image above, there is double encode occurred when the page tries to re-login with another username. The first encode is %25 while the second one is %20. This the one that causes the error page appeared on your screen browser. When I look for the solution through the internet, some suggested to
install SharePoint Cumulative Update September 2014 or higher, but still did not work out.
This problem was totally bugging my head for days. I tried a lot of trial suggested from the google starting from re-configure the web.config of the SharePoint web app I created until by adding some feature in IIS manager and config that particular feature, but still no luck and no clue what was happening. Until I finally found one miracle blog that shows how to which I would like to call it as a trick this problem rather than a permanent solution, but I am totally sorry for not sharing the originate blog that I found because I forgot to bookmark the link :(
Long story short, the author of that blog guided me to add one java script inside the closeconnection.aspx file that is placed under C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\
The script that you need to add under this file is like the one below:
========================================================================
if (pageUrl.match(/%2520/)) pageUrl = pageUrl.replace(/%2520/g,"%20");
========================================================================
Just place the script after "ageUrl = pageUrl.replace("_layouts/closeConnection.aspx", "_layouts/accessdenied.aspx");" and before "window.location = pageUrl;",
So the file will look like this after you make the changes:
After adding that java script, just save the file, and try again (you don't need to do IIS reset on command prompt). This should work fine in your SharePoint.
Hope this blog will bright your day a little :D
thanks for visiting my blog