1

When our SharePoint 2010 intranet login page loads on desktop PC'S, our Windows Authentication link shows up, this way members can log-in properly. But for some reason, specifically with iPhones and Droid Smart Phone devices, we get the login page but no request for windows authentication. So my question - how can we apply Windows Authentication to log-in form pages, if the user is coming from an iPhone or Droid?

FYI - once the user hits our main intranet page, SharePoint is redirecting mobile users to a custom mobile form page under my /_layouts/ directory, which has no activity of windows authentication for some smart phones. I really want to figure out how to apply windows authentication to the custom form under my _layouts/ directory for all smart phone device users.

Thanks for any advice!

2
  • Are you looking to add an Authentication Provider to your login process? We did something similar, but it was not for SmartPhone support, so I am not sure if that would work for you. We did it through the web config by adding a data provider, no DLL was really needed.
    – MichaelF
    Commented Oct 11, 2012 at 13:08
  • Thank you MichaelF for the quick response. I can look into the web config as a last resort. If SharePoint provides a way for members to sign in with authentication on desktop pages, it would appear reasonable to copy that same link system and apply to the mobile mblogin.aspx page under the hood, unless someone here can educate me differently that it's a bad idea. Thanks again for the web config idea.
    – klewis
    Commented Oct 11, 2012 at 14:25

1 Answer 1

1

Take a look at this blogpost it seems as if you need some custom code to perform the authentication request.

http://tomaszrabinski.pl/wordpress/2011/06/23/sharepoint-2010-custom-login-page/

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     using Microsoft.SharePoint.IdentityModel.Pages;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.Utilities;
    using zavaz.CustomLoginPage.Data.Classes;
    using zavaz.CustomLoginPage.Data.Helpers;
     using System.Diagnostics;
     using System.Text.RegularExpressions;

  namespace zavaz.CustomLoginPage.Forms.ASPX
 {
 public class SignInForm : FormsSignInPage
  {
 protected Label lblError;

 protected override void OnInit(EventArgs e)
  {
 base.OnInit(e);
  }

  protected override void OnLoad(EventArgs e)
{
try
{
 base.OnLoad(e);
}
catch { }
  }

  protected void lbInternalUsers_OnClick(object sender, EventArgs e)
  {
  try
  {
  if (null != SPContext.Current && null != SPContext.Current.Site)
 {
  SPIisSettings iisSettings =    SPContext.Current.Site.WebApplication.IisSettings[SPUrlZone.Default];
if (null != iisSettings && iisSettings.UseWindowsClaimsAuthenticationProvider)
 {
SPAuthenticationProvider provider = iisSettings.WindowsClaimsAuthenticationProvider;
  Redirect(provider);
 }
 }
  }
   catch (Exception ex)
 {
   lblError.Text = ex.Message;
  }
    }

    private void Redirect(SPAuthenticationProvider provider)
      {
     string comp =   HttpContext.Current.Request.Url.GetComponents(UriComponents.Query,  UriFormat.SafeUnescaped);
     string url = provider.AuthenticationRedirectionUrl.ToString();
   if (provider is SPWindowsAuthenticationProvider)
      {
    comp = EnsureUrl(comp, true);
      }

     SPUtility.Redirect(url, SPRedirectFlags.Default, this.Context, comp);
      }

      private string EnsureUrl(string url, bool urlIsQueryStringOnly)
      {
  if (!url.Contains("ReturnUrl="))
    {
        if (urlIsQueryStringOnly)
       {
        url = url + (string.IsNullOrEmpty(url) ? "" : "&");
       }
        else
       {
      url = url + ((url.IndexOf('?') == -1) ? "?" : "&");
      }
      url = url + "ReturnUrl=";
      }
    return url;
    }
       }
      }
3
  • Thank you so much Joseph for the quick reply! I read the article and still feel unsure about it. The author wants us to place a .dll file in the GAC. I have read several articles online that stats that is not a good practice. Is there anything I could do to depend only on the .aspx code to make this project work, rather than depending on code behind or a .dll file? Thank you so much for any tips, and the patience to deal with me, as I am not as strong as I hope to be in this area.
    – klewis
    Commented Oct 10, 2012 at 16:21
  • hmmm I will try some solutions and come with a better answer Commented Oct 10, 2012 at 16:38
  • I'm not sure why he would say that but it really does depend on what that assembly is doing and if you trust it before putting it in the GAC. I know one thing the default forms for sharepoint will do the pop up on mobile devices. Commented Apr 4, 2013 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.