Installing SharePoint Foundation 2010 – Step by Step

We are always fall in problem to install SharePoint 2010 for the first time. Here is the step by step approach to install SharePoint 2010. This article is very much handy to install SharePoint Foundation 2010. Installation of other version of SharePoint is almost same. Here I have installed Windows 2008 Server in VMWare Workstation with 4GB of RAM. Below is the step by step approach to install SharePoint 2010.

Step 1: Install Windows 2008 Server R2

Step 2: Configure Windows Server 2008 R2 to install SharePoint 2010

Step 3: Create Domain Controller

Step 4: Install SQL Server – 2008 R2

Step 5: Install Prerequisites

There are two ways to install prerequisite –

i)        First way – Download the following prerequisites according to your Server Requirements and install it’s to the server. Keep in mind, some are already installed in your computer so don’t worry about installation problem. May be all prerequisite is not necessary for your server.
a.  Windows 2008 R2 and Windows Server 2008 KB971831
b. WCF Fix article for Windows 2008 R2 and Windows 7 KB976462
c. Microsoft SQL Server 2008 Native Client
d. Microsoft “Geneva” Framework Runtime
e. Microsoft Sync Framework Runtime v1.0 (x64)
f. Microsoft Chart Controls for Microsoft .NET Framework 3.5
g. Microsoft SQL Server 2008 Analysis Services ADOMD.NET
h. PowerShell V2 RTM
i. SQL Server 2008 SP1
j. .NET Framework 3.5 Service Pack 1 (Full Package)
k. Microsoft Filter Pack x64 for sharepoint

ii)       Second way – This is the very easy way. Just click executable file (SharePointFoundation.exe). Click “Install software prerequisite” of the screen.


Click “Next” to start installation of pre requisites


Mark for license Agreement and Click Next

1-2Pre requisites is installing.


Click Finish to complete installation of Pre requisites.


Step 6: Start SharePoint 2010 Foundation installation – Click Executable file (SharePointFoundation.exe). Click “Install SharePoint Foundation” in the splash screen.


Step 7: Mark to the license agreement and click Continue.


Step – 8: Browse data location and Click “Install Now”

4Installation Progress…


Step 9: Mark “Run the SharePoint Product Configuration Wizard now” and click “Close”.


Step 10: Click “Next” of the SharePoint Products Configuration Wizard.


Step 11: Click “Yes” of the following pop up screen and then click “Next”.


Step 12: Select “Create a new server farm” and then click “Next” of the following screen.


Step -13: Type your database server name, database Name (default: SharePoint_Config), user name (domain name\User name) and password in the following Database Settings screen.


Step 14: Type Passphrase and confirm passphrase in the Farm Security Settings screen and click “Next”


Step 15: To specify port of Central administration we application – Mark specify port number and type your desired port. Select NTLM as default as authentication provider for Web application.


Step 16: Click “Next” in following SharePoint Product Configuration Wizard. If required click Advanced Settings for advanced configuration


Configuring SharePoint Products…..

14Step 17: You will see the following screen after configuring SharePoint Server successfully. Necessary information is given here. Click “Finish” to continue.


Step 18: Type username (my user name: Administrator) and password to enter the server.


Step 19: Select “No, I don’t wish to participate” and click “ok” in the following screen.


Step – 20: Click “Start the Wizard” in the following screen.


Step -21: Select “Use existing managed account” and click “Next”


20Step -22: Type site title and description, select template as Team site and click Ok.


Step – 23: Farm configuration completed. Click “Finish” in the Farm Configuration wizard.


Step – 24: Now you will see the central administration. If you see in the closer look, you will see it uses port -2010(read circle) which you configured at step – 15.


Step – 25: If you want to see the site which you already created just type “htttp://yourservername:80” in the url.

24Yes! You have successfully installed and configured SharePoint 2010. Thanks for your patience.

Populate Dropdownlist with selected Index

This is a demo to populate dropdownlist by C#.

Step 1: Create a dropdownlist

Create a dropdownlist in page. Here, I created a dropdownlist name ddlStudentInfo.

Step 2: Create StudentInfo class

Create a student info class to create list of StudentInfo object.

public class StudentInfo
public int Id { get; set; }
public string Name { get; set; }

Step 3: Populate dropdownlist

Create a list of StudentInfo object. Make it data source of dropdownlist and choose your selected index. Here, I choose selected index 2 means dropdownlist shows Asrafuzzaman as selected text and 3 as selected value. I have write all those in Page Load. You can do as you required.

protected void Page_Load(object sender, EventArgs e)
List lstStudentInfo = new List();

StudentInfo objStudentInfo1 = new StudentInfo();
objStudentInfo1.Id = 1;
objStudentInfo1.Name = "Mahedee Hasan";


StudentInfo objStudentInfo2 = new StudentInfo();
objStudentInfo2.Id = 2;
objStudentInfo2.Name = "Mahmud Ahsan";

StudentInfo objStudentInfo3 = new StudentInfo();
objStudentInfo3.Id = 3;
objStudentInfo3.Name = "Asrafuzzaman";

StudentInfo objStudentInfo4 = new StudentInfo();
objStudentInfo4.Id = 4;
objStudentInfo4.Name = "Enamul Haque";

ddlStudentInfo.DataSource = lstStudentInfo;
ddlStudentInfo.DataValueField = "Id";
ddlStudentInfo.DataTextField = "Name";
ddlStudentInfo.SelectedIndex = 2; //Selected index 2 means selected value is 3 and text is Asrafuzzaman



File Upload to Server with

File Upload to Server with Uploading file to server from client sometimes very tricky. Sometimes it is required that you will not upload file more than certain size. This is the step by step approach to upload file from client to server.

Step 1: Add html input type as file

<input id =”uploadFile” type=”file” runat=”server” />

Step 2: Create a button to upload file in the server

<asp:Button ID=”Button1″ runat=”server” OnClick=”Button1_Click”  />

Step 3: Create a folder in the web project like “TempFiles”
Step 4: Upload file in the server.

protected void Button1_Click(object sender, EventArgs e)

if (this.uploadFile.PostedFile != null)
// Get a reference to PostedFile object
HttpPostedFile huploadFile = uploadFile.PostedFile;

// Get size of uploaded file
int nFileLen = huploadFile.ContentLength;

decimal fileSize = uploadFile.PostedFile.ContentLength / 1024;
if (fileSize > 100) //If file size is no more than 100 KB
this.lblMsg.Text = "Size of this image is greater than 100KB";

byte[] scriptData = new byte[nFileLen];

// Read uploaded file from the Stream
huploadFile.InputStream.Read(scriptData, 0, nFileLen);

string filePath = Server.MapPath("TempFiles");

filePath = filePath + "\\" + Path.GetFileName(uploadFile.PostedFile.FileName); //concate filename with file path
FileStream newFile = new FileStream(filePath, FileMode.Create);

// Write data to the file
newFile.Write(scriptData, 0, scriptData.Length);

// Close file
lblMsg.Text = "This is an empty file";


How to copy folder with content with C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CopyFolder
class Program
static void Main(string[] args)
string sourcePath = @"G:\Mahedee_Share\Created";
string destPath = @"G:\Mahedee_Share\Development";

private static void CopyFolder(string sourcePath, string destinationPath)


//Now Create all of the directories
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*",
Directory.CreateDirectory(dirPath.Replace(sourcePath, destinationPath));

//Copy all the files & Replaces any files with the same name
foreach (string newPath in Directory.GetFiles(sourcePath, "*.*",
System.IO.File.Copy(newPath, newPath.Replace(sourcePath, destinationPath), true);
catch (Exception exp)


How to configure IIS for different port

1.      Open IIS Manager (run -> inetmgr)
2.      In the Connections pane, expand the Sites node in the tree, and then click to select the site for which you want to add/edit binding.
3.      Right click on the site and click Edit bindings
4.      Select Port on the site binding pane
5.      Click Edit button
6.      In Edit Site Binding pane type port (ex. 1080) and click Ok
IIS Port change

How to Create Domain Controller in Windows Server 2008 R2

Domain concept is introduced in windows NT. Domain Controller (DC) is a server that is responsible to maintain security within window server domain. To install Domain Controller (DC) in Windows Server 2008 R2, follow the steps.

Step 1: Click “Start -> Administrative tools -> Server Manager -> Roles -> Add Roles”


Step 2: Click next on the following screen.


Step 3: Select Server Role – “Active directory domain service” and Click Next.


4Step 4: Click “Install”


Step 5: Now install DNS Server and active directory service. Go to “run” and type “dcpromo”


Step 6: In Active Directory Domain Services Installation Wizard. Press “Next” and don’t check on “Use advance mode installation”.



Step 7: Select “Create a new domain in a new forest” and click “Next” on the following screen


Step 8: Type your domain name and click “Next”.


Step 9: Select Windows Server 2008 R2 and click “Next”


Step 10: If this is the first Domain controller then the following message will be visible. Check “DNS Server” and click “Next”

12Step 11: Press “Yes” to continue.


Step 12: Select the location to keep log of Active Directory Domain Controller.


Step 13: Type administrator password and Confirm password for directory service and click “Next”


Step 14: Click “Next” of Summary window and check reboot the computer of the following screen.



Step 15: Your Domain Controller installed successfully. Now login to the system by domain Id.


Install SQL Server 2008 R2 – Step by Step

We often fall problem to install SQL Server 2008 R2. Here is the step by step procedure to install SQL Server 2008 R2. Microsoft .NET Framework 3.5 SP1 is the pre-requisite for SQL Server 2008 R2. If it is not installed in your computer, install it before proceed to the setup procedure.

Step 1: Run DVD of SQL Server 2008 R2 or Open DVD and click setup.exe


Step 2: Select Installation and Click New installation or add features to an existing installation.


Step 3: After completing pre installation check, press Ok.


Step 4: Type Product Key and click “Next”.


Step 5: Select License Term and click “Next”.


Step 6: Click “Install” in the following screen.


Step 7: Setup performed Support Rules Validation. If no error found, click “Next”. Turn off your windows firewall from control panel to eliminate warning of windows firewall of following screen.


Step 8: Select Setup Role – SQL Server Feature Installation. Click Next.


Step 9: Select Features or Click “Select All” and click “Next”.


Step 10: Click “Next” of Installation Rule windows.
10Step 11: Select Default Instance for simplicity and click “Next”.11

Step 12: Click “Next” after confirming disk space requirement


Step 13: In the Server Configuration Screen click “Use the same account for all SQL Server Services”


Step 14: In the Pop up screen type user name with domain name and password. Then click Ok.


Step 15: Click “Next” in the Server Configuration Screen.


Step 16: Select Mixed Mode, type password and confirm password. Click “Add Current user” and click Next in Database Engine Configuration Screen.


Step 17: Click “Add Current User” & “Next” in Analysis Service Configuration Screen.


Step 18: Select Native Mode & Click Next in Reporting service configuration screen.


Step 19: Click “Next” in error reporting screen.

Step 20: Click “Next” in the following screen.

20Step 21: Click “Install” in the following screen.

21Installation progressing……22

Step 22: Complete Installation. Click Close button.


Difference between String and StringBuilder

String and StringBuilder class both are used to handle string.
StringBuilder is an immutable class means that you can insert, append and replace without creating a new StringBuilder instance each time.
String is immutable, each time you perform an operation on the string – you are actually creating a new instance of string to replace the old one.
So according to the discussion, the StringBuilder is more efficient for operations to manipulate strings.
The most common operation with a string is concatenation. When you use the “String” object to concatenate two strings, the first string is combined to the other string by creating a new instance in the memory and then the old string is deleted.
When you make a “StringBuilder” object for concatenation the Append method is used which is perform insertion operation on the existing string. So, StringBuilder is more efficient in case of large amounts of string manipulation.

Have a look on the following code snippet.

string str = string.Empty;
for (int i = 0; i < 1000; i++) { str += i.ToString() + ” “; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < 1000; i++) { sb.Append(i); sb.Append(‘ ‘); } [/csharp] Now think, which one is faster? Right! The second one. Because, for the first snippet, every time new instance of string is created and the for the second one, StringBuilder instance is created only at once.

Display information by Literal Control

The literal control is similar to the Label control. Unlike the Label control, the Literal control does not render its content inside of a tag. You can use the Literal control to display text or HTML content in a browser.

Literal control does not support either CssClass or BackColor properties.

Literal control has mode property which Label has not.
Three mode property of Literal control:

  1. PassThrough: Displays the contents of the control without encoding.
  2. Encode: The contents of the control are converted to an HTML-encoded string.
  3. Transform: Unsupported markup-language elements are removed from the contents of the control. If the Literal control is rendered on a browser that supports HTML or XHTML, the control’s contents are not modified.

You will be clear after watching output of the following

Write the following code in your aspx page. Here I used 4 literal. 1st one for displaying simple message from code behind. Others 3 are displayed the content in different mode of literal.


protected void Page_Load(object sender, EventArgs e)
    this.ltrlMsg.Text = "Welcome to Literal Control!";

The output of the code is look like this.
Welcome to Literal Control!
This is Mahedee Hasan
This is Mahedee Hasanll
This is Mahedee Hasan