How to Sign in as a Different User in SharePoint 2013
SharePoint used to have a menu option called "Sign in as Different User" in the top-right corner of every page. It was a handy tool for developers and IT professionals in SharePoint 2007 and 2010, which allowed them to login with another account to test their solutions or customizations. Microsoft removed the option in SharePoint 2013, but you can still do it with workarounds or a one-click bookmarklet.

WHY WAS THIS FEATURE REMOVED
I don't know why Microsoft removed this feature. What I do know is it was never perfect and has a number of issues in SharePoint 2007 and 2010. Some of the most common issues are:
- • Caching problems
- • Documents opened in external applications are saved with an unexpected user account
- • Right after user logs in with a different account, the page content shows information from the previous account and the cookies are not properly cleared
In other words, this feature was never meant as a security mechanism. Therefore, even though it's possible to bring the menu option back, you should carefully consider whether doing so is really necessary. After all, it was removed for a reason.
If you want to bring the menu option back for all users, you can modify the Welcome.ascx file in the 15-hive on each server by following Nick Grattan's blog post. If you just want to be able to log in with a different account without this menu option, read on.
HOW TO SIGN IN AS A DIFFERENT USER
Developers and/or IT administrators, myself included, often have to log in with a different user account to test their solutions or customizations, or get a higher-level permissions in a SharePoint site. Even though the menu option is missing, there are several workarounds that can be used to log in as a different user in SharePoint 2013.
Method 1: Internet Explorer's Different User Option
The most common way to sign in as a different user is with Internet Explorer's "Run as different user" option. Just right-click the IE icon while holding the shift key down and click on "Run as different user." Once logged in, just navigate to the SharePoint site. This method is quite cumbersome but it does allow you to run multiple instances of IE and be logged in as a different user in each one.
Note for the Windows 7 or 8 users: if you have IE pinned to your taskbar, holding the shift key and right-clicking on the taskbar icon won't work. You have to right-click the IE icon in the taskbar first, then hold the shift key and right-click on the Internet Explorer option.
Method 2: Navigate to the Close Connection Page
A slightly faster way to accomplish this is to navigate to the Close Connection page. Just visit the following URL in your browser:
http://<site URL>/_layouts/closeConnection.aspx?loginasanotheruser=true
As soon as you hit this page, the familiar pop-up will prompt you for the username to log in with. Once you log in, you will be redirected to the home page.
BOOKMARKLET TO SIGN IN AS A DIFFERENT USER
Bookmarklet (bookmark + applet) is a web browser bookmark that contains JavaScript commands in the URL. This means we can build a bookmarklet that uses JavaScript Object Model in SharePoint 2013 to automate the second method above.
First, let's build the script which uses SharePoint client context to redirect the user to the URL specified above:
- if (typeof SP !== 'undefined') {
- var ctx = new SP.ClientContext.get_current();
- var site = ctx.get_site();
- ctx.load(site, 'Url');
- ctx.executeQueryAsync(Function.createDelegate(this, function(sender, args) {
- var url = site.get_url();
- window.location = url + '/_layouts/closeConnection.aspx?loginasanotheruser=true';
- }), Function.createDelegate(this, function (sender, args) {
- alert('Error: ' + args.get_message());
- }));
- } else {
- alert('Error: This is not a SharePoint 2010 or 2013 website');
- }
Basically, what we are doing is getting the client context of the current SharePoint site, loading the "Url" property of the "site" object via an AJAX request, and then redirecting the browser to the Close Connection page. If we fail to load the "site" object, we display the error. We also display an error if "SP" is undefined, which means that you are not on a SharePoint 2010 or 2013 website.
This script can be tested in the Console window of your browser's development tools. Now we need to add this script to a hyperlink that can serve as a bookmarklet. To do so, just create an HTML file and add the following text to it, which includes the script above without line breaks:
- <a href="javascript: (function(){if (typeof SP !== 'undefined') { var ctx = new SP.ClientContext.get_current(); var site = ctx.get_site(); ctx.load(site, 'Url'); ctx.executeQueryAsync(Function.createDelegate(this, function (sender, args) { var url = site.get_url(); window.location = url + '/_layouts/closeConnection.aspx?loginasanotheruser=true'; }), Function.createDelegate(this, function (sender, args) { alert('Error: ' + args.get_message()); })); } else { alert('Error: This is not a SharePoint 2010 or 2013 website'); }})();">SP Login</a>
Open this HTML file in your favorite browser, and drag and drop this link to your bookmarks/favorites bar. Alternatively, you can just create a new bookmark in your browser, call it "SP Login" (or whatever else you like) and use the content of the "href" property of the hyperlink above in place of its URL. Unfortunately, some technical limitations are preventing me from adding this bookmarklet directly to this post.
Incidentally, this bookmarklet can also be used to log in as a different user in SharePoint 2010, since it also exposes the JavaScript Object Model. This can be useful in some scenarios, for example if you have a staging environment for your public site where the ribbon controls are only shown to the "admin" accounts, which are different from your main AD account you use in your organization.
How to Sign in as a Different User in SharePoint 2013的更多相关文章
- SharePoint 2013 启用 以其他用户身份登陆(Sign in as different user)
习惯于SharePoint 2010的用户会发现,SharePoint 2013默认把 以其他用户身份登陆(Sign in as different user)的选项去掉了,这对于开发人员来说很麻烦 ...
- Sharepoint2013切换用户菜单
Sharepoint2013中没有切换用户的菜单,每次登录后,浏览器就会记住密码.要重新换一个用户登录的时候,就需要把浏览器都关闭,然后重新启动.这样非常不方便.特别是在测试权限这一块的时 ...
- Integrating SharePoint 2013 with ADFS and Shibboleth
Time again to attempt to implement that exciting technology, Federation Services (Web Single Sign On ...
- 关于如何在Android、Java等非微软平台上建立高信任的SharePoint应用程序
关于如何在非微软平台上建立高信任的SharePoint应用程序 原文 :http://blogs.msdn.com/b/kaevans/archive/2014/07/14/high-trust-sh ...
- SharePoint 2013 一些小技巧
一.添加“SharePoint 2013 切换用户”标签 相比SharePoint 2010,SharePoint2013版本去掉了切换用户登陆的功能(如下图),其实这个可以通过改welcome.as ...
- Sharepoint-Hosted App in 2013资料
一个完整的流程,可参考网址 My First Sharepoint-Hosted App in 2013 部署第一个APP会遇到各种问题,可以参考网址 App development in Share ...
- SharePoint安全 - 在Goolge和Bing中查找SharePoint相关内容
博客地址 http://blog.csdn.net/foxdave 本篇提供两个查询串字典,分别对应Google和Bing的搜索,用来查询SharePoint网站的相关内容 Google ShareP ...
- 【FBA】SharePoint 2013自定义Providers在基于表单的身份验证(Forms-Based-Authentication)中的应用
//http://www.cnblogs.com/OceanEyes/p/custom-provider-in-sharepoint-2013-fba-authentication.html 由于项目 ...
- [FBA]SharePoint 2013自定义Providers在基于表单的身份验证(Forms-Based-Authentication)中的应用
//http://tech.ddvip.com/2014-05/1401197453210723.html 由于项目的需要,登录SharePoint Application的用户将从一个统一平台中获取 ...
随机推荐
- ubuntu的配置文件
ubuntu的配置文件 是 ~/.gconf 我是把终端弄挂了, 只能再桌面系统下找到 ~/.gconf 下的相应文件 修改后就恢复到原来状态.
- delphi shr和shl的作用
x:=x shl 1 二进制数向左移1位,尾部补1个零,相当于x:=x*2;x:=x shl 2 二进制数向左移2位,尾部补2个零,相当于x:=x*4;...x:=x shl n 二进制数向左移n位, ...
- Unity3D实践系列08, MonoBehaviour类的各种触发事件
在脚本的生命周期中,有Awake, Start, FixedUpdate, Update, LateUpdate等方法,其实这些属于MonoBehaviour类的事件响应方法,是MonoBehavio ...
- 5日均线MACD
1.5日均线: 5日均线是股市术语,就是股票5天的成交价格或指数的平均值,所对应的是股价的5日均线和指数的5日均线(5MA).均线指标实际上是移动平均线指标的简称. 一般在K 线图中会有3 条或4 条 ...
- Android之 MTP框架和流程分析
概要 本文的目的是介绍Android系统中MTP的一些相关知识.主要的内容包括:第1部分 MTP简介 对Mtp协议进行简单的介绍.第2部分 MTP框架 介绍 ...
- delphi services允许跨域访问
delphi services允许跨域访问 unit WebModuleUnit1; procedure TWebModule1.WebModule1DefaultHandlerAction(Send ...
- windows nginx出现 was not signaled for 5s的看过来
windows下 nginx 配置ssl的key是不能存储密码的,否则启动时会提示输入密码 输入后也启动不起来,会报错: 2011/04/18 09:49:09 [alert] 1992#4548: ...
- C#编程(六十四)----------并行扩展
并行的扩展 扩展1. Parallel的使用: 在Parallel下面有三个常用的方法Invoke,For,ForEach Parallel.Invoke()方法是最简单,最简洁的将串行的代码并行化. ...
- vs2010 :0X80041FEB 程序集无法修改版等内容
AssemblyInfo.cs内容被清空或则格式有问题,无法修改,一个问题搞了8个小时 gisoracle 2018.09.22 包括加入现在项目,加入form多,都不正常,不能显示,一次稍加几个
- hbase经常使用的shell命令样例
1.hbase shell 进入hbase [hadoop@mdw ~]$ hbase shell HBase Shell; enter 'help<RETURN>' for lis ...