手机访问Form认证报错

Cannot access protected member 'Microsoft.SharePoint.MobileControls.SPMobilePage.strReturnUrl'

打过2011 August CU的会出现这个问题,替换mbllogin.aspx成SP1版本就可以。

<%@ Register TagPrefix="GroupBoardMobile"   Namespace="Microsoft.SharePoint.Applications.GroupBoard.MobileControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#"   EnableViewState="false" inherits="Microsoft.SharePoint.MobileControls.SPMobilePage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %> <%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="SPMobile" Namespace="Microsoft.SharePoint.MobileControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <mobile:StyleSheet RunAt="Server" ID="SharePointMobileStyleSheet" />
<%@ Import Namespace="System.Web.Configuration" %>
<%@ Import Namespace="System.Web.Mobile" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.Administration" %>
<%@ Import Namespace="Microsoft.SharePoint.IdentityModel" %>
<%@ Import Namespace="Microsoft.SharePoint.Utilities" %>
<script RunAt="server">
private string strReturnUrl = "ReturnUrl";
protected override Microsoft.SharePoint.SPBasePermissions RightsRequired
{
	get
	{
		return Microsoft.SharePoint.SPBasePermissions.EmptyMask;
	}
}
protected override void OnInit(EventArgs e)
{
	base.OnInit(e);
	if (null == Request.QueryString[strReturnUrl])
	{
		string filePath  = this.Request.FilePath;
		string fileName  = System.IO.Path.GetFileName(filePath);
		string returnUrl = filePath.Replace(fileName, SPMobileUtility.DefaultFileName);
		string redirectUrl =
			filePath + '?' + strReturnUrl + '=' + SPHttpUtility.UrlKeyValueEncode(returnUrl);
		this.Response.Redirect(redirectUrl, true);
	}
}
protected void Login_Click(Object sender, EventArgs e)
{
	SPIisSettings iisSettings = SPMobileUtility.GetIisSettings(this.Context);
	if (iisSettings.UseClaimsAuthentication)
	{
		if (SPClaimsUtility.AuthenticateFormsUser(this.Request.Url, mobileLoginTextBox.Text, mobilePwdTextBox.Text))
		{
			string redirectUrl = this.Request.QueryString[strReturnUrl];
			redirectUrl = SPHttpUtility.UrlPathEncode(redirectUrl, true, true);
			SPMobileUtility.Redirect(redirectUrl, SPRedirectFlags.DoNotEncodeUrl, this.Context);
		}
	}
	else
	{
		if (IsAuthenticated(mobileLoginTextBox.Text, mobilePwdTextBox.Text))
		{
			FormsAuthentication.SetAuthCookie(mobileLoginTextBox.Text, false);
			MobileFormsAuthentication.RedirectFromLoginPage(mobileLoginTextBox.Text, false);
		}
	}
	lblError.Visible = true;
}
private bool IsAuthenticated(string user, string password)
{
	if (AuthenticationMode.Forms == SPSecurity.AuthenticationMode)
	{
		return Membership.ValidateUser(user, password);
	}
	return false;
}
</script>
<mobile:Form RunAt="Server" Paginate="false">
	<DeviceSpecific>
		<Choice Filter="supportsCss">
			<HeaderTemplate>
				<SPMobile:SPMobilePaddedPanel RunAt="Server" ForeColor="#FFFFFF" BackColor="#21374C" Font-Bold="True" Font-Size="13pt">
					<mobile:Label RunAt="Server" Text="<%$Resources:wss, login_pagetitle%>" BreakAfter="true" />
				</SPMobile:SPMobilePaddedPanel>
				<mobile:Label                 RunAt="Server" Text=" " />
			</HeaderTemplate>
			<FooterTemplate>
				<mobile:Label                 RunAt="Server" Text=" " />
				<SPMobile:SPMobilePaddedPanel RunAt="Server" BackColor="#F6F6F6">
					<mobile:Command RunAt="Server" ID="mobileLoginButton" Text="<%$Resources:wss, login_pagetitle%>" BreakAfter="true" OnClick="Login_Click" />
				</SPMobile:SPMobilePaddedPanel>
			</FooterTemplate>
		</Choice>
		<Choice>
			<HeaderTemplate>
				<mobile:Label               RunAt="Server" Text="<%$Resources:wss, login_pagetitle%>" BreakAfter="true" />
				<SPMobile:SPMobileComponent RunAt="Server" TemplateName="MobileDefaultSeparator" />
			</HeaderTemplate>
			<FooterTemplate>
				<SPMobile:SPMobileComponent RunAt="Server" TemplateName="MobileDefaultSeparator" />
				<mobile:Command             RunAt="Server" ID="mobileLoginButton" Text="<%$Resources:wss, login_pagetitle%>" BreakAfter="true" OnClick="Login_Click" />
			</FooterTemplate>
		</Choice>
	</DeviceSpecific>
	<mobile:Label   RunAt="Server" ID="mobileLoginLabel"   Text="<%$Resources:wss, login_pageUserName%>"    BreakAfter="true" />
	<mobile:TextBox RunAt="Server" ID="mobileLoginTextBox"                                                  BreakAfter="true" />
	<mobile:Label   RunAt="Server" ID="mobilePwdLabel"     Text="<%$Resources:wss, login_pagePassword%>"    BreakAfter="true" />
	<mobile:TextBox RunAt="Server" ID="mobilePwdTextBox"   Password="true"                                  BreakAfter="true" />
	<mobile:Label   RunAt="Server" ID="lblError"           Text="<%$Resources:wss, login_pageFailureText%>" BreakAfter="true" ForeColor="Red" Visible="false" />
</mobile:Form>

 或者通过修改IIS 的computer.browser文件把mobile浏览器检测都关掉。这样让sharepoint直接使用PC的所有页面。

http://www.khamis.net/blog/Lists/Posts/Post.aspx?ID=51

参考资料

http://sharepoint.stackexchange.com/questions/28477/cannot-access-protected-member-microsoft-sharepoint-mobilecontrols-spmobilepage

http://www.spugs.ch/SPUGSBlog/Lists/Posts/Post.aspx?ID=64

 

posted @ 2012-06-25 11:26  Sunmoonfire  阅读(91)  评论(0)    收藏  举报