Thursday, June 18, 2015
99X Technology wins Great Place To Work award for 3 consecutive years
Friday, October 21, 2011
Configuring Forms Based Authentication (FBA) in SharePoint 2010
Steps
- Create MSSQL membership store
- Create the new web application
- Configure support for FBA
- In Central Administration
- In new web application
- In STS web service (new in SharePoint 2010)
- Adding user policies to the web application
- Login to the site
This is where all the user details going to be store.
- Create the database
- Run the ASP.NET SQL Server Setup Wizard located at C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe and follows the instructions.
- Once completed create a separate database user and assign that user and add the “db_owner” role.
- Add users into the membership store
- Launch the Visual Studio and create a web site project
- Add a connection string pointing to the above created database
- Launch the “ASP.NET Configuration” wizard in “Website” menu item.
- Click on the “Security” link and select the “internet” option and add users in to the store.
Step 2: Create the new web application
- Go to Central Administration > Manage web applications and click on the “New” in the ribbon
- Set the settings in the dialog box as in the below images (Check the red boxes)
- Once the web application created, create the site collection as well.
- Edit the web.config for the central administration in the virtual directories folder
- Add the following entry just above the </system.web> node
<membership defaultProvider="AspNetSqlMembershipProvider">
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add connectionStringName="AspNetSqlProvider" passwordAttemptWindow="10" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" description="Stores and retrieves membership data from the Microsoft SQL Server database" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<roleManager defaultProvider="AspNetWindowsTokenRoleProvider">
<providers>
<clear />
<remove name="AspNetSqlRoleProvider" />
<add connectionStringName="AspNetSqlProvider" applicationName="/" description="Stores and retrieves roles data from the local Microsoft SQL Server database" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
- Add the below connectionString details just above the </configuration> node and put the corresponding values for the database,user id and password
<connectionStrings>
<add connectionString="Data Source=eccolw7ira;Initial Catalog=<database>;User ID=<user id>;Password=<password>" name="AspNetSqlProvider" />
</connectionStrings>
- Edit the web.config for the corresponding site in the virtual directories folder
- Add the following entry just above the </system.web> node.
- Note : If the membership entry is already available , add only the missing entries (Highlighted in Yellow) from the bellow entry.
| <membership defaultProvider="i"> <providers> <add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <remove name="AspNetSqlMembershipProvider" /> <add connectionStringName="AspNetSqlProvider" passwordAttemptWindow="10" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" description="Stores and retrieves membership data from the Microsoft SQL Server database" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </membership> <roleManager defaultProvider="c"> <providers> <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <remove name="AspNetSqlRoleProvider" /> <add connectionStringName="AspNetSqlProvider" applicationName="/" description="Stores and retrieves roles data from the local Microsoft SQL Server database" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </roleManager> |
- Add the below connectionString details just above the </configuration> node and put the corresponding values for the database,user id and password
| <connectionStrings> <add connectionString="Data Source=eccolw7ira;Initial Catalog=<database>;User ID=<user id>;Password=<password>" name="AspNetSqlProvider" /> </connectionStrings> |
- Edit the web.config located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken
- Add the following entry just above the </configuration> node
| <system.web> <membership defaultProvider="AspNetSqlMembershipProvider"> <providers> <add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <remove name="AspNetSqlMembershipProvider" /> <add connectionStringName="AspNetSqlProvider" passwordAttemptWindow="10" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" description="Stores and retrieves membership data from the Microsoft SQL Server database" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </membership> <roleManager defaultProvider="AspNetSqlRoleProvider" enabled="true" cacheRolesInCookie="false"> <providers> <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <remove name="AspNetSqlRoleProvider" /> <add connectionStringName="AspNetSqlProvider" applicationName="/" description="Stores and retrieves roles data from the local Microsoft SQL Server database" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </roleManager> </system.web> <connectionStrings> <add connectionString="Data Source=eccolw7ira;Initial Catalog=<database>;User ID=<user id>;Password=<password>" name="AspNetSqlProvider" /> </connectionStrings> |
- Go to Central administration > Manage web applications and select the web application and click on the “User Ploicy” button in ribbon.
- Click on the “Add users” link and select the “Default” as the zone and click on “Next”.
- Type the user name in the “Users” text box and click on the People Picker icon.
- If everything configured correctly you should see the user name get underlined in the “users” box. OR
- Click on the “Browse” button under the users text box and type the user name in the search text box and click on the search button.
- And you should see the user name in the search result.
Step 5: Login to the site
- Open the site in browser and select the “Forms Authentication” from the drop down
- Provide the user credentials and you should be redirected to the home page
Wednesday, May 18, 2011
Setting assembly version automatically when building in a Bamboo server
How to instruct your msbuild script to set the correct “AssemblyVersion” of your libraries using “AssemblyInfo.cs” when building in a Bamboo server.In Puzzlepart it is vital to have the current build number and the current revision number in the assembly version of products.
Solution :
Assembly version syntax : <major version>.<minor version>.<build number>.<revision>
More info can be found here about the syntax.
Step 1 : First you need to make sure the corresponding Build-Specific Variable are passed into the build script.
How ?
In Bamboo build configuration under the “Builder” tab you have “Options” where you can pass msbuild command line switches.Step 2 : Accessing those variables from the msbuild script
example : /p:BuildKey=${bamboo.buildKey} /p:BuildPlanName=${bamboo.buildPlanName} /p:BuildNumber=${bamboo.buildNumber} /p:Revision=${bamboo.custom.svn.revision.number}
![]()
<PropertyGroup>Step 3 : Create the Assembly version using those properties
<MajorVersion Condition="'$(MajorVersion)' == ''">1</MajorVersion>
<MinorVersion Condition="'$(MinorVersion)' == ''">0</MinorVersion>
<BuildNumber Condition="'$(BuildNumber)' == ''">0</BuildNumber>
<Revision Condition="'$(Revision)' == ''">0</Revision>
<BuildPlanName Condition="'$(BuildPlanName)' == ''">LocalBuild</BuildPlanName>
<BuildKey Condition="'$(BuildKey)' == ''">NOKEY</BuildKey>
</PropertyGroup>
<PropertyGroup>Step 4 : Use the assembly version in “AssemblyInfo” task
<ComputedAssemblyName>$(MajorVersion).$(MinorVersion).$(BuildNumber).$(Revision)</ComputedAssemblyName>
</PropertyGroup>
<AssemblyInfo CodeLanguage="CS"
OutputFile="$(ApplicationName)\Properties\AssemblyInfo.cs"
AssemblyTitle="ApplicationName"
AssemblyDescription="Description"
AssemblyCompany=""
AssemblyProduct="$(ApplicationName)"
AssemblyCopyright="Copyright © "
ComVisible="false"
CLSCompliant="false"
Guid="248D49F7-BC5D-4413-8E4A-98B4654B1594"
AssemblyVersion="$(ComputedAssemblyName)" />
Monday, July 12, 2010
Sharepoint foundation 2010 on windows 7 x64
The second step under “To set up a developer workstation” failed successfully because of this command “c:\SharePointFiles\SharePoint /extract:c:\SharePointFiles”
Here it referred to a file called “SharePoint” but the name of the downloaded application was “SharePointFoundation.exe”. So in order to pass this step I had to change the name from “SharePoint” to “SharePointFoundation” in the above command.
After that I continued with the installation steps and managed to launch the setup.exe after completing the installation of prerequisites mentioned.
In the 3rd step under the “Step 3: Install SharePoint 2010” I select the “Server Farm” option and in the next step I selected the standalone option.I had no clue what so ever why I selected that option, but it happened for some reason and it worked.
Then I had to wait for a quite a longer time to complete the installation and prompted to run the sharepoint configuration wizard.
And finally after the configuration wizard completed, it prompted the newly created sharepoint team site.(See image at top)
Now sharepoint foundation 2010 at my finger tips so that I can start playing with it.
Wednesday, September 02, 2009
How to create active directory users programmatically
Recently one of my colleagues wanted a piece of code which can be created 500 users in Active Directory for some testing purposes.Knowing that this won’t be a big challenge I said I will give it a try.
Frankly speaking, initially I thought this will be a easy walk in the park.Creating the user in AD part was a piece of cake but the created user was not enabled by default.
I had to figure out how to enable a user account programmatically.That was the only tricky part.
Check the user enabling code segment in the code.(Setting the "userAccountControl" property of the user)
Here is the code
References :string ldapPath = "LDAP://" + server + "/cn=Users,dc=ec,dc=test";
DirectoryEntry entry = new DirectoryEntry(ldapPath, user, pwd);
for (int i = 0; i < userCount; i++)
{
string tempName = userPrifix + i;
DirectoryEntry newUser = entry.Children.Add("CN=" + tempName, "user");
newUser.Properties["givenName"].Add(tempName);
newUser.Properties["userPrincipalName"].Add(tempName + "@ec.test");
newUser.Properties["sAMAccountName"].Add(tempName);
newUser.Password = userPwd;
newUser.CommitChanges();
// Enabling the above created account
int flags = (int)newUser.Properties["userAccountControl"].Value;
newUser.Properties["userAccountControl"].Value = flags & ~0x2;
newUser.CommitChanges();
newUser.Close();
entry.Close();
}
http://www.codeproject.com/KB/system/everythingInAD.aspx
http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm
Friday, August 14, 2009
How to avoid inline codes in user controls in SharePoint web parts
Check here how to use web application projects to develop web parts.
So I was very fond of that method till I figured out, this is not going to inline with the SharePoint deployment techniques.Especially if you are using wsp solution packages and 12 hive structure in Visual Studio with WSPBuilder.
Recently in a project that I was working with, I used a slightly different approach to which I was used to.That is not using web application projects but I used the user control(*.ascx file) with inline codes for the web part in the templatecontrol folder.
There are pros and cons having inline codes.
The code is visible to a person who has access to the server directly.
If it is a complex web part your lines of code will be very high and which will lead to readability and maintainability issues.
Today I managed to figure out how to move inline code into your main assembly of your SharePoint solution and I thought of sharing that with you.
SampleWebPartControl.ascx (user control)
What is important here is that the entry in the RED box in above image.That is the way you specify where the code behind can be found for this user control.
SampleWebPartCOntrol.cs(code behind)
The initialization of user controls you are using is paramount(check the RED box in this image).I had all sorts of problems till I sorted that out.
Solution Structure
Check where the items in the RED box in this image.



