Showing posts from 2014

How to automatically generate unique id in sql?

In sql there are many options to generate unique number. Here I am explaining about how to generate standard unique number in sql.

Below is sql query :

CREATE TABLE dbo.tblTable1
   username varchar(200),city varchar(200)

State Management in C#

In my other blogs, you may read C# 6.0 new features
In this blog, I will explore about State Management in C#. If you have attended an interview as a C#.Net developer, then questions related to State Management is likely to be asked.

what are differences between classic mode and claim based authentication in SharePoint 2010

what are differences between classic mode and claim based authentication in SharePoint 2010

Classic mode authentication: This is nothing but windows authentication. It means it will work based on you windows logged in credentials. There is a problem in classic mode authentication. Once a site is created under this authentication then Form based authentication can not be configured on the site.

Claim based authentication: Claim based authentication provides you a way to implement form based authentication as well as windows authentication. It is built on Security Assertion Markup Language (SAML) and Windows Identity Foundation.

How to work with features in SharePoint?

How to work with features in SharePoint? Feature deployment and activation in sharepoint

Feature is used to give some enhancement in SharePoint site.

Please follow below steps to use feature in SharePoint site.
Paste these two .xml files in below location.
C:\Program Files\Common Files\Microsoft Shared\webserver extensions\12\TEMPLATE\FEATURES\myfolder\
Here is both .xml files.

feature.xml (code)
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns=""
         Title="My Custom Action Feature"
         Description="Adds Custom Actions to the Web Site."
         Version="" >
<ElementManifest Location="element.xml"/>  

<?xml version="1.0" encoding="utf-8" …

Introduction to WCF.

What is WCF? WCF stands for Windows Communication Foundation. The main use of WCF is to develop distributed system. WCF main feature is interoperability.

WCF tutorial for beginners and experience

WCF stands for Windows Communication foundation. It is used for developing distributed system.

Below are the topics which are important in WCF for beginners and for experience as well.

Learn OOPS concept in simple and easy way

In this blog, We will see Object Oriented Programming Principal in simple and easy way.

Basics of WCF Architecture

WCF Architecture WCF stands for Windows Communication Foundation, introduced by Microsoft. WCF is one of the popular technology to build Service-Oriented Systems.

WCF vs Web Services

Most useful and most asked question in an interview is WCF vs Web Services.
It could be asked in various form like Why WCF is better than Web Services

WCF and Web Services both are the implementation of SOA (Service Oriented Architecture), both are SOAP-based services.

Is it important to dispose an object in sharepoint ? what is the reason for poor performance.

Sharepoint foundation 2010 and sharepoint server 2010 object model contain objects that implement the IDisposable interface. Object disposal is very important in sharepoint.

Disposing Objects:

Sharepoint foundation 2010 and sharepoint server 2010 object model contain objects that implement the IDisposable interface.
You should explicitly dispose those sharepoint objects that implements IDisposable when you are finished using them.

Why to dispose?

SPSIte and SPWeb class objects are created as managed objects. However, these objects use unmanaged code and memory to perform their work. The manage part of the object is smaller than the unmanaged part.As smaller managed part does not put memory pressure, but large amount of unmanaged code can cause unusual behaviors.

So we should not rely on Garbage collector to release.
How to find incorrect Disposed objects--
--If system performs poor.

--If system crashes or user faces unexpected errors.

If your site is displaying unusual errors, there …

How to add an active class in navigation menu item in website?

How to add an active class in navigation menu item in website? Generally active class show which page /link you are visiting currently. Active class will be added in css class, but the problem is only one item can have active class at one time. But we need to show active class dynamically.

how to do url rewrite in implemented in asp.net4.0 version

how to do url rewrite in implemented in asp.net4.0 version

Url rewriting is just to display a friendly and readable url instead of a comlex or unfriendly url.

Suppose there is a url in your website just like below:

The disadvantages of above mentioned url are:

1. This is not a friendly url.
2. The url does nt looks descent.
3. Last but the major thing is this url is not readable by Google and other search engine.

So, if your website contains url like above then there is no meaning of your content of that page because it will not be indexed by google.

So, how can it be avoid and how it can be re write in a seo friendly and readable url.

In 3.0 it was not an easy task to complete. But in asp.net4.0 it is very easy.

I am explaining this for 4.0 version.

First add a Global.asax file in your project.

Add the reference of System.Web.Routing in your project.
And then add this <%@ Import Namespace="System.Web.Ro…

Three tier architecture in ASP.Net using C# code

Read my other blogs, C# 6.0 new features, ASP.Net Tutorial and .Net Core Tutorial.
In this blog, we will see 3-tier architecture to develop an application in C#.

How to send email to a user using workflow in SharePoint2010

How to send email to a user using workflow in SharePoint2010

Suppose there is a scenario that when ever you add a new item to a list in SharePoint site immediately an email should be sent to a specific member or user.
Here I will explain this scenario by using SharePoint designer 2010.
Please follow below steps:
1. Open SharePoint site in SharePoint designer. 2. File-New-Workflow  3. Once the dialog box opened then Enter the name of workflow and then select sharepoint list or library on which you want your workflow to be execute. and click Next. 5. Dont forget to select workflow start option, i.e. whether you want it to be started automatically or manually. 5. From Actions select send an Email. 6. Now click on this message, in the action that appears now. 7. Now in the new dialog box, enter the user email id in To box. 8. Then type a subject in subject box. 9. Now click OK.
Now, you can test your workflow by adding an item in list.

Can we implement interface with same method name?

Interface is similar to a class, and we implement interface by defining their method in class. Suppose we have same method in more than one interface.

In this case there will be a question for interview.

Q.    Can we implement interface with same method name?
Ans. Yes by using explicit interface implementation.

Lets see below example:

class Program
        static void Main(string[] args)
            MyInterface1 obj1 = new MyClass();
            MyInterface2 obj2 = new MyClass();

        interface MyInterface1
            void func1();

        interface MyInterface2
            void func1();

        class MyClass : MyInterface1, MyInterface2
            void  MyInterface1.func1()

            void MyInterface2.func1()

What is safe control in SharePoint 2010?

In SharePoint Environment a developer can add ASPX file very easily. An ASPX file contains code which may affect the SharePoint environment. In simple words, there might be a security risk of security injection.

How to create a batch file to do automatic backup of SharePoint site?

Suppose you have a SharePoint site with some heavy and important data and you want to take the backup regularly. So instead of manual process you can create a batch file which will automatically take the backup of the mentioned site.

Below is the given script:
Write below code in a notepad and save it as .bat file.

@echo off
@echo This script will backup your site: [Enterprise Management Site]
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
@echo locking site collection before the backup process starts
@echo off

stsadm -o getsitelock -url http://moss-server:333/
stsadm -o setsitelock -url http://moss-server:333/  -lock readonly
@echo site collection is now locked
@echo off
stsadm -o backup -url http://moss-server:333/  -filename C:\RRSbackup\autobackup.bak -overwrite @echo backup completed
@echo off
stsadm -o setsitelock -url http://moss-server:333/  -lock none
@echo Site lock removed

Once you ready with your batch file then you can put this…