Using Change Password ASP.NET control in SharePoint 2010 FBA.


Create a new SharePoint 2010 Empty Project in visual studio 2010.

Right click the project à Add New Itemà Select “Application Page”.

Add the ChangePassword control inside PlaceHolderMain content place holder

<asp:Content ID=”Main” ContentPlaceHolderID=”PlaceHolderMain” runat=”server”>

<asp:ChangePassword
id=”myChangePassword”
newpasswordregularexpressionerrormessage=”Error: Your password must be at least 5 characters long, and contain at least one number and one special character.” runat=”server” CancelDestinationPageUrl=”~/pages/default.aspx” OnContinueButtonClick=”ContinueClickHandler” MembershipProvider=”SqlMembers”  OnChangingPassword=”ChangingPassword” OnChangedPassword=”ChangedPassword”></asp:ChangePassword></asp:Content>

Put the following code for OnChangingPassword and OnChangedPassword Event handler in the code behind. 

 // the username would be in the following format
 // 0#.f|sqlmembers|nishantr
 // so we need to get only the username part
 // otherwise it wont work properly
protected void ChangingPassword(object sender, EventArgs e)
{
System.Web.UI.WebControls.ChangePassword chngPassword = (System.Web.UI.WebControls.ChangePassword)sender;
chngPassword.UserName = chngPassword.UserName.Substring(chngPassword.UserName.LastIndexOf("|") + 1);
}

// add reference to Microsoft.SharePoint.IdentityModel dll
protected void ChangedPassword(object sender, EventArgs e)
{
System.Web.UI.WebControls.ChangePassword chngPassword = (System.Web.UI.WebControls.ChangePassword)sender;
FormsAuthentication.SignOut();
Microsoft.SharePoint.IdentityModel.SPClaimsUtility.AuthenticateFormsUser(new Uri(SPContext.Current.Web.Url), chngPassword.UserName, chngPassword.NewPassword);
}


Check this really helpful pack

http://sharepoint2010fba.codeplex.com/

Hope it helps.

Add reference to Microsoft.SharePoint.IdentityModel.dll


Had trouble finding the above assembly to add reference to it. It wasn’t there in the 14 hive. The location where we can find it is

C:\Windows\assembly\GAC_MSIL\Microsoft.SharePoint.IdentityModel\

Bye.

The type initializer for ‘System.Data.SqlClient.SqlConnection’ threw an exception


I was getting the above error in one of my windows application. Was because of some section getting repeated in the app.config file.

Removing the duplicate section information from the app.config resolved the issue.

Initializing and setting DefaultCrendentials for OrganizationService in CRM 2011


I created a simple windows application just to see how to make use of IOrganizationService within CRM 2011.

Here we need to add references to the following dlls

  1. Microsoft.Xrm.Sdk.
  2. System.ServiceModel.
  3. System.Runtime.Serialization.

This is the sample code

Uri organizationUri = new Uri("http://crmservername/orgname/XRMServices/2011/Organization.svc");
Uri homeRealmUri = null;
ClientCredentials credentials = new ClientCredentials();
// set default credentials for OrganizationService
credentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;
// or
credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
IOrganizationService _service = (IOrganizationService)orgProxy;
try
{
    Entity myAccount = new Entity("account");
    myAccount["name"] = "Test Account";
    _service.Create(myAccount);
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}
}

Dependent Picklist (OptionSet) in CRM 2011


Hi,

Today i was just trying to check if the dependent picklist code generated using Microsoft Dynamics CRM Demonstartion Tools for CRM 4.0 will work for CRM 2011 or not.

So i downloaded the tool

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=634508DC-1762-40D6-B745-B3BDE05D7012&displaylang=en

I was able to connect CRM 2011 using that tool. Then i generated the code using the tool.


I tried using that code inside CRM 2011 and it worked properly.

Only thing we need to do is to wrap the entire onload code generated by tool inside a function and call that function on the onload of the form and same thing for the onchange code.

Bye.

SPUpgradeException Exception message: An error has occurred on the server.http://go.microsoft.com/fwlink?LinkID=96177


Hi I got the error while trying to open the SharePoint Site after applying the MOSS SP2 update to it.

This post was helpful in resolving that error

http://social.technet.microsoft.com/forums/en-US/sharepointadmin/thread/4cce44de-4b5a-4dcb-a369-be65654ff80e/

  • Nachrichten dieses Autors suchen

    Hi Guys

    I had the same problem. and i fixed it by going here
    http://www.microsoft.com/downloads/details.aspx?familyid=A49472F9-93E…

    download the file that matches your OS. ie x32 or x64
    If you try to run the file it will tell you the patch is already installed.
    but run the file with “/extract” extrace the file to someware and run
    “dw20w.msp”
    Let it do its thing. It takes a while……Then presto. well as least for
    me.

    Let me know how you guys go with it.

    Hope it helps!

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓