none
Anonymous access for mobile users RRS feed

  • Question

  • I have set up anonymous access on a sharepoint 2010 publishing site, and that works fine. However, when I try to access the site from a mobile device ( or in a browser with a url of http://server/pages/default.aspx?Mobile=1), I get 401 Unauthorized.

    In the IIS log, it's showing a 401 on: /_layouts/mobile/mblwp.aspx

    Any suggestions for getting anonymous to work for mobile users?

    Thanks,

    Mike

    Friday, July 16, 2010 2:36 PM

Answers

  • We too encountered this problem. After a few hours of research and diving into the SharePoint assemblies with reflector I have found a way to get it to work. As in, to display the normal website on all mobile devices. This was our goal, so I didn't research options to get the mobile view to work on a public facing site.

    For this, add within the web.config file of the WebApp in the section configuration/system.web:

     <browserCaps>
      <result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      <filter>isMobileDevice=false</filter>
    </browserCaps>

    This method is officially deprecated since the .NET Framework 3.0, but works like a charm. Needless to say that one could easily wrap this in a feature event receiver to adjust the web.config files upon deployment.

    • Proposed as answer by Koen Zomers Monday, September 20, 2010 2:10 PM
    • Marked as answer by m g Tuesday, September 21, 2010 1:22 PM
    • Edited by Koen Zomers Thursday, October 28, 2010 5:34 PM
    Monday, September 20, 2010 2:09 PM
    • Marked as answer by m g Tuesday, September 21, 2010 1:29 PM
    Monday, July 19, 2010 12:05 PM

All replies

  • Hi ,

    Have you read this ?

    http://msdn.microsoft.com/en-us/library/ms462572.aspx

     

    Regards.

    Shafaquat Ali


    M.C.I.T.P Exchange 2007/2010, M.C.I.T.P Windows Server 2008, M.C.T.S OCS Server 2007 R2, Phone: +923008210320
    Saturday, July 17, 2010 8:29 AM
  • What device are you specifically tried to use? I've looked into this previously and found mixed results based on the mobile device and browser being used. 
    John Ross
    SharePoint Server MVP | Sr. Consultant SharePoint911: SharePoint Consulting
    Blog: http://www.sharepoint911.com/blogs/john
    Twitter: @JohnRossJr

    Professional SharePoint 2010 Branding and User Interface Design
    Sunday, July 18, 2010 6:47 PM
  • Mike,

    When you state it works fine in the browser (anonymous) are you referring to this access of the sites internally or externally?

    Have you setup AAM?


    Blog: Alpesh Nakar's Blog | Twitter: Follow Alpesh on Twitter |SharePoint Resources: Just SharePoint Resource Center | Follow Just SharePoint updates on Twitter | SharePoint Conference South East Asia Singapore Oct 26-27 2010 | Contributing Author SharePoint 2010 Unleashed | MCTS: SharePoint 2010 Configuration | MCITP: SharePoint 2010 Administrator
    Monday, July 19, 2010 12:06 AM
  • I did find that link earlier, thanks. Though I didn't find anything there about anonymous access... Did I miss something?

     

    Mike

    Monday, July 19, 2010 12:20 AM
  • I have not yet set up AAM. I can access the site normally from IE. If I switch the IE options to not submit credentials automatically and try the page (using the same url) again in a new window, I can access the site anonymously. If I add ?mobile=1 to the URL, then I get "not authorized".

    Certainly AAM would have to be set up eventually, but I'm currently just trying to get anonymous working on the original URL.

    Thanks,

     

    Mike

     

     

     

    Monday, July 19, 2010 12:29 AM
    • Marked as answer by m g Tuesday, September 21, 2010 1:29 PM
    Monday, July 19, 2010 12:05 PM
  • This may be a moot point, as the mobile pages for publishing sites are quite inadequate. However:

    When a mobile user connects to the site, they are automatically redirected to mblwp.aspx. If you open this file in notepad, it includes the following:

    return base.RightsRequired | Microsoft.SharePoint.SPBasePermissions.ViewPages;

    This page is a WebPartMobilePage, which inherits from an SPMobilePage. The default value of the RightsRequired property in an SPMobilePage is ViewFormPages (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.mobilecontrols.spmobilepage.rightsrequired.aspx). However, when I check the AnonymousPermMask64 for my web, it's only returning ViewListItems, ViewVersions, Open, ViewPages, and UseClientIntegration.

    So what am I missing? How do I give anonymous users the proper permissions to view mblwp.aspx? Did I miss something in the configuration? Or do they not have this capability (again, not that it would be a huge loss, as the mobile views for publishing sites isn't worth much)?

    Mike

     

    Tuesday, July 20, 2010 5:51 PM
  • I have the same problem for the past weeks and countless google research with no luck :-( 

    Wednesday, August 11, 2010 4:06 PM
  • We had a similar issue. I looked into it and I think narrowed it down to the fact that the lockdown feature is preventing access to the mobile view pages. Disabling this feature will allow access, but is probably not something that you want to do on a public facing site!

    I put a post up on my blog detailing my findings: http://www.glynblogs.com/2010/08/sharepoint-2010-publishing-sites-and-mobile-views-authentication-issue.html

    Thanks
    Glyn

    --------------------------
    w: http://www.glynblogs.com
    t: @GlynClough

    Tuesday, August 17, 2010 2:00 PM
  • We too encountered this problem. After a few hours of research and diving into the SharePoint assemblies with reflector I have found a way to get it to work. As in, to display the normal website on all mobile devices. This was our goal, so I didn't research options to get the mobile view to work on a public facing site.

    For this, add within the web.config file of the WebApp in the section configuration/system.web:

     <browserCaps>
      <result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      <filter>isMobileDevice=false</filter>
    </browserCaps>

    This method is officially deprecated since the .NET Framework 3.0, but works like a charm. Needless to say that one could easily wrap this in a feature event receiver to adjust the web.config files upon deployment.

    • Proposed as answer by Koen Zomers Monday, September 20, 2010 2:10 PM
    • Marked as answer by m g Tuesday, September 21, 2010 1:22 PM
    • Edited by Koen Zomers Thursday, October 28, 2010 5:34 PM
    Monday, September 20, 2010 2:09 PM
  • Koen,

    I don't like this answer, but I think it's the best thing we can do at this point. Effectively, we disable the redirect for mobile users in a kludgy way. (another mechasism for this is here: http://blogs.inetium.com/blogs/bcaauwe/archive/2010/06/28/disable-mobility-features-for-sharepoint-2010.aspx)

    Of course, if we did want to optimize the experience for mobile users like many sites do, and provide a smaller version of the page for mobile users?...

    Thanks,

    Mike

    Tuesday, September 21, 2010 1:22 PM
  • Thanks,

    As I mentioned in another post in this thread, this is not a great answer, but perhaps it's the best we have at the moment. I'd rather be able to easily redirect users to a mobile version of the page instead of the only option being to disable the feature. This solution is also problematic in that compat.browse could change in the future, causing some users to again experience access denied messages until the file was re-modified.

    Mike

    Tuesday, September 21, 2010 1:29 PM
  • Hi Koen,

    It worked for all mobiles and iPhone but when I browsed my web on BlackBerry 9000 i saw my site in the form of list :(

    Kindly tell me how can I resolve this issue for all BlackBerrys

    Thanks,

    Kamran

    Wednesday, October 13, 2010 8:18 AM
  • Mike,

    I've tried the method with the .browser files, but SharePoint would simply ignore them here. The method I describe will gain all devices access to the same normal site. You could try to dig into the possibilities of the browserCaps section in the web.config to find out how to redirect to a different page for certain (mobile) devices.

    Another option I can think of is to put a piece of code in your codebehind of your homepage or masterpage which will check if it's a mobile device and redirect based on the results of that verification.

    The first would be a more elegant solution, but also more time consuming to figure out. The second is probably easier to realize, although it might be a challenge to detect a mobile device since the web.config option I describe above will disable the built-in functionality of .NET to detect those devices.

    Thursday, October 28, 2010 5:29 PM
  • Kamran,

    sounds like your BlackBerry did actually hit the mobile version of the website which is strange because that's exactly what shouldn't be possible for anonymous access and why we applied this workaround. I have no idea why this device behaves differently from the standard mobile device detection in .NET. I also have no such device here to try to simulate a similar situation so I'm afraid I can't help you with it. You could try attaching the debugger to your SharePoint site and query for the parameters of the mobile device in the Request object. Maybe that will shine a light on as to why it is detected as a mobile device.

    Thursday, October 28, 2010 5:33 PM
  • Just posting a followup.

    This solution looks good, but has a significant flaw that I'm still working on (and just posted a thread in the customization group about): The out of the box master pages use an overflow tag that mobile browsers don't support (overflow:auto). Apparently, the mobile browsers convert that to "overflow:none". Which means that mobile browsers won't be able to scroll down the page.

    For example, on my android phone, if I view my site in "portrait" mode, the site starts out zoomed all the way out. I can then zoom in and scroll around. However, if I view the same page in "landscape" mode, only the top half of the page is displayed, and there are no scroll bars. So the bottom of the page is cut off.

    I have confirmed that this is an issue on android devices, iPhones, and iPads.

     

    The other thread is:

    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010customization/thread/aa4010a5-a38c-4f65-b416-038fa7467cca

     

     


    Mike G.
    Thursday, February 3, 2011 4:48 PM
  • Note for iOS Safari users, the no-code work around for scrolling up/down on SharePoint 2010 pages is to use 2-fingers to scroll up/down or left/right on a page.  I have confirmed this to work.  I also have seen some dev hacks to the master page that will fix this as well.

    Below is the code I was presented via email, but I HAVE NOT TESTED, and claim no stake that it will work.

    ----------------------------------------------

    Basically, this is an overflow issue with the div tags in the masterpage.  To fix it, you can use a fixed position style in css.

    1.  Remove the "scroll=no" attribute of the masterpage body
    2 . You then need to add a little javascript
    //----Start Code----
      //set top padding of the workspace to the height of the ribbon
    function setTopPadding() {
       var wrkElem = document.getElementById('s4-workspace');
       var ribHeight = document.getElementById('s4-ribbonrow').offsetHeight;
       if (window.location.search.match("[?&]IsDlg=1")) {
          //margin works better for dialogs b/c of scrollbars
          wrkElem.style.marginTop = ribHeight + 'px';
          wrkElem.style.paddingTop = '0px';
       }
       else {
         //padding works better for the main window
         wrkElem.style.paddingTop = ribHeight + 'px';
       }
    }

    // bind top padding reset to ribbon resize event so that the page always lays out correctly.
    ExecuteOrDelayUntilScriptLoaded(function () { SP.UI.Workspace.add_resized(setTopPadding); }, "init.js");
    //----End Code----
    3. Last is to add the updated CSS
     
    //----Start Code----
    body, body.v4.master {overflow:visible !important; height: inherit; width: inherit; }

    body #s4-workspace {overflow:visible !important; padding-top:44px;}

    /*This sets up our Ribbon for a fixed position. */
    body #s4-ribbonrow{ position: fixed;top:0px;z-index:1000;width: 100%;}
    * html #s4-ribbonrow {position:absolute;}

    /* Set the ribbon popups to be fixed position also */
    #s4-ribbonrow .ms-MenuUIPopupBody, #s4-ribbonrow .ms-popoutMenu, .ms-cui-menu[id ^= "Ribbon."], .ms-cui-tooltip {
    position: fixed !important;
    }
    * html #s4-ribbonrow .ms-MenuUIPopupBody, * html #s4-ribbonrow .ms-popoutMenu, * html .ms-cui-menu[id ^= "Ribbon."], * html .ms-cui-tooltip {
    position: absolute !important;
    }

    /*Make sure there are no scroll bars on our popup overlays*/
    .ms-dlgOverlay {width: 100% !important }
    //----End Code----

    Tuesday, April 19, 2011 1:15 PM
  • Hi Koen,
    I'm kind of new to the mobile access in SharePoint 2010 and have been tasked with disbling mobile redirection. I'm interested in the code snippet addition to the web.config, but I'm unsure exactly where to place it. It says to add it to the configuration/system.web section. the closest I've found is the system.web.configuration.systemwebextensionssectiongroup...is that the correct area? Am I even close? Any help would be much appreciated! Thanks!
    Thursday, May 12, 2011 1:08 PM
  • Hi RobJ77.

    Put it directly under <system.web> (search for that).

    Like this http://screencast.com/t/g08cZMNPF (yellow represents what you are searching for, green represents what you are adding in, AFTER TAKING A BACKUP COPY of web.config of course ;)

    Hope that helps


    Sean Wallbridge, SharePoint MVP | Victoria, BC | On The Web: http://www.itgroove.net | Blog: http://blog.brainlitter.com
    Tuesday, July 19, 2011 6:43 PM
  • This worked like a charm. Thanks a ton.


    Smidha

    Tuesday, February 14, 2012 6:33 AM
  • Still working for SharePoint 2016 :)

    Thanks a million for this tip.

    Tuesday, June 25, 2019 6:27 AM