Monday, 29 April 2013

How to Install SharePoint 2010 in Windows 7

In my previous articles i explained Asp.NET, C#.NET, jQuery. In this article i was explaining how to install SharePoint 2010 on Windows 7 OS.

Please follow the below steps carefully.

Installing SharePoint Foundation on Windows 7 64 bit
Please install Visual Studio 2010 first (Software location will be provided)
For installing SharePoint Foundation (Software location will be provided), please follow the steps mentioned in this document in that order.
Copy the SharePointFoundation.exe installation file to c:\SharePointFiles (This is important)
Extract the installation files by opening a Command Prompt window, and then typing the following command at the directory location of the folder where you copied the installation files in the previous step. Please follow the below screen shot:
Open command prompt and go to c:\SharePointFiles as shown below


Then type  SharePointFoundation /extract:c:\SharePointFiles\ as shown in screen shot below

Then the files will be extracted to C:\SharePoint files as shown below

Using a text editor such as Notepad, open the installation configuration file, config.xml, located in the following path: c:\SharePointFiles\files\Setup\config.xml
Add the following setting as it is under configuration tab: (This is case sensitive)
      <Setting Id="AllowWindowsClientInstall" Value="True"/>
Save and close the config.xml
Then open the command prompt and install Microsoft FilterPack 2.0 by typing
c:\SharePointFiles\PrerequisiteInstallerFiles\FilterPack\FilterPack.msi (screen shot below)

Next step is to copy paste the below text(as it is) at the command prompt as show in the screen show below:
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;^
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;^
IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;^
IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;^
IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ManagementScriptingTools;^
IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;^
IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;^
IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;^
IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;^
WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;^
WCF-NonHTTP-Activation
It takes a while to enable the features. After the process is done please open the control panel to make sure all the features are enabled: Please follow below steps:
1.       Open Control Panel
2.       Click on Programs
3.       Click on Turn Windows Features on or Off
4.       Make sure the features below in the next two screen shots are enabled


After checking that the features are enabled, Please RESTART your machine.
After restarting the machine, to install SharePoint Server 2010 or SharePoint Foundation 2010, open a Command Prompt window, and then type the following at the command prompt:




Click on STANDALONE


After installation, Please close the wizard after unchecking the checkboxRun the SharePoint Products Configuration wizard
      
Next step is to install Windows Identity Foundation. Download link will be provided.( File name will be Windows6.1-KB974405-x64.msu)
After installing Windows Identity Foundation,Please install the hotfix for SQL Server 2008. File name will be SQLServer2008-KB970315-x64.exe . Download location will be provided. (Screen shots below).









Click close and then Run the SharePoint 2010 Product Configuration Wizard.(Screen shot below)
(Start->All Programs ->Microsoft SharePoint 2010 Products ->SharePoint 2010 Product Configuration Wizard)

You should be able to open the Central Administration.
(Start->All Programs ->Microsoft SharePoint 2010 Products ->SharePoint 2010 Central Administration)

Thursday, 18 April 2013

How to upload PDF document in ASP.NET application


In Previous Articles i explained how to upload image into Database. In this article i explained How to upload pdf document with in asp.net application

Default.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebTestSharp._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Web Barcode Reader Tester (C#)</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Click browse button to upload a PDF document<br />
        <asp:FileUpload ID="FileUpload1" runat="server" /><br />
        <br />
        <asp:Button id="UploadButton" 
           Text="Upload file"
           OnClick="UploadButton_Click"
           runat="server">
       </asp:Button> 
        <br />
       <br />
        <asp:Label id="UploadStatusLabel" Text="" runat="server"></asp:Label> 
        <br />
        <asp:ListBox ID="ListBox1" runat="server" Visible="False"></asp:ListBox><br />
        <br />
        </div>
    </form>
</body>
</html>

===================================================================
VB.NET Code


Imports System.Drawing

Imports Bytescout.BarCodeReader


Public Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub UploadButton_Click(sender As Object, e As EventArgs)
Dim savePath As [String] = "\uploads\"

If FileUpload1.HasFile Then
Dim fileName As [String] = FileUpload1.FileName
savePath += fileName
FileUpload1.SaveAs(Server.MapPath(savePath))

            Dim barcodeReader As New Reader()

            ' reader.MediumTrustLevelCompatible = true ' uncomment this line to enable Medium Trust compatible mode (slows down the recognition process as direct image data access is disabled in Medium Trust mode)


            UploadStatusLabel.Visible = False
            ListBox1.Items.Clear()
            ListBox1.Visible = True

            ListBox1.Items.Add("Reading barcode(s) from PDF")

            Dim barcodes As FoundBarcode() = barcodeReader.ReadFrom(Server.MapPath(savePath))

            If barcodes.Length = 0 Then
                ListBox1.Items.Add("    No barcodes found")
            Else
                For Each barcode As FoundBarcode In barcodes
                    ListBox1.Items.Add([String].Format("    Found barcode with type '{0}' and value '{1}'", barcode.Type, barcode.Value))
                Next
            End If


        Else
            ' Notify the user that a file was not uploaded.
            UploadStatusLabel.Text = "You did not specify a file to upload."
        End If
End Sub
End Class
===================================================================
C#.NET Code



using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Drawing.Imaging;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Collections.Generic;

using Bytescout.BarCodeReader;

namespace WebTestSharp
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void UploadButton_Click(object sender, EventArgs e)
        {
            String savePath = @"\uploads\";

            if (FileUpload1.HasFile)
            {
                String fileName = FileUpload1.FileName;
                savePath += fileName;
                FileUpload1.SaveAs(Server.MapPath(savePath));

Reader barcodeReader = new Reader();

            // reader.MediumTrustLevelCompatible = true; // uncomment this line to enable Medium Trust compatible mode (slows down the recognition process as direct image data access is disabled in Medium Trust mode)
UploadStatusLabel.Visible = false;

                    ListBox1.Items.Clear();
                    ListBox1.Visible = true;
ListBox1.Items.Add("Reading barcode(s) from image #" + imgNum);

FoundBarcode[] barcodes = barcodeReader.ReadFrom(savePath);

if (barcodes.Length == 0)
{
ListBox1.Items.Add("    No barcodes found");
}
else
{
foreach (FoundBarcode barcode in barcodes)
ListBox1.Items.Add(String.Format("Found barcode with type '{0}' and value '{1}'", barcode.Type, barcode.Value));
}

            }
            else
            {
                // Notify the user that a file was not uploaded.
                UploadStatusLabel.Text = "You did not specify a file to upload.";
            }
        }
    }
}

=====================================================================