February 2, 2010

Dotnet Interview Questions

SDLC

SDLC (System Development Life Cycle) is overall process of developing information systems through multistep process systems from investigation of initial requirements through analysis, design, implementation and maintenance.

Types of SDLC

· Waterfall Model.

· Spiral Model.

· Build and Fix model.

· Rapid prototyping Model.

· Incremental Model.

1. (Initiation)System Requirement: - This is initial stage of the project where end user requirements are gathered and documented.

2. (Planning) System Design: - In this stage detail requirements, screen layout, business rules, process diagram, pseudo code and other documentations are prepared. This is first step in technical phase.

3. (Execution) Implementation: - Depending on the design document actual code is written here.

4. (Controlling) Integration and Testing: - All pieces are brought together and tested. Bugs are removed in this phase.

5. (Closure) Acceptance, Installation and Deployment: - This is final stage where software is put in production and runs actual business.

6. Maintenance: - This is least glamorous phase which runs forever. Code Changes, correction, addition etc are done in this phase.

Diff of Abstract classes and Interfaces

Interfaces

Abstract classes

begins with a keyword interface so it is of type interface

declared with the abstract keyword so it is of type class

It has no implementation, but they have to be implemented.

These methods can have implementations and they have to be extended.

It can only have method declaration (implicitly public and abstract)

and fields (implicitly public static)

These methods can’t have implementation only when declared abstract.

It can inherit more than one interface.

It can implement more than one interfaces, but can inherit only one class

It must override all abstract method and may override virtual methods.

It can be used when the implementation is changing

It can be used to provide some default behavior for a base class.

It makes implementation interchangeable.

It have increase security by hiding the implementation.

It can be used when implementing framework

These are an excellent way to create planned inheritance hierarchies and also to use as non-leaf classes in class hierarchies.

Generalization and Specialization in OOPS

Just like abstraction is closely related with generalization and the inheritance is closely related with specialization.

One of the most important relationships among objects in the real world is specialization, which can be described as the “is-a” relationship.

Example: When we say that a dog is a mammal, we mean that the dog is a specialized kind of mammal. It has all the characteristics of any mammal (it bears live young, nurses with milk, has hair), but it specializes these characteristics to the familiar characteristics of canis domesticus. A cat is also a mammal. As such, we expect it to share certain characteristics with the dog that are generalized in Mammal, but to differ in those characteristics that are specialized in cats.

The specialization and generalization relationships are both reciprocal and hierarchical.

Specialization is just the other side of the generalization coin: Mammal generalizes what is common between dogs and cats, and dogs and cats specialize mammals to their own specific subtypes.

In OOP, the specialization relationship is implemented using the principle called inheritance.

Data abstraction

Data abstraction refers to, providing only essential features by hiding its background properties (or) implementation details.
 
Example:
class result
{
int marks;
float percentage;
char name[20];
void input();
void output();
}
 
main()
{
bank b1;
b1.input();
b1.output();
}
 
in the above example, b1 is an object calling input and
output member functions, but that code is invisible to the
object b1.

Encapsulation:

It is the ability of an object to hide its data and methods from the rest of the world. It is one of the fundamental principles of OOPs.

Example:
Public class Calculations
{
private void fnMultiply(int x, int y)
{
return x * y;
}
}
...
...
Calculations obj;
int Result;
Result = obj.fnMultiply(5,10);

Polymorphism

It means the ability to request that the same operations be performed by a wide range of different types of things.

In OOP the polymorphisms is achieved by using many different techniques named as

· Method overloading

· Operator overloading

· Method overriding

Method Overloading:

The method overloading is the ability to define several methods all with the same name.

public class MyLogger

{

public void LogError(Exception e)

{

// Implementation goes here

}

public bool LogError(Exception e, string message)

{

// Implementation goes here

}

}

Operator Overloading:

The operator overloading is a specific case of polymorphisms in which some or all of operators like +, - or == are treated as polymorphic functions and as such have different behaviors depending on the types of its arguments

public class Complex
{
    private int real;
    public int Real    { get { return real; } }
 
    private int imaginary;
    public int Imaginary    { get { return imaginary; } }
 
    public Complex(int real, int imaginary)
    {
        this.real = real;
        this.imaginary = imaginary;
    }
 
    public static Complex operator +(Complex c1, Complex c2)
    {
        return new Complex(c1.Real + c2.Real, c1.Imaginary + c2.Imaginary);
    }
public override string ToString()
    {
        return (String.Format("{0} + {1}i", real, imaginary));
    }
 
}

I above example I have overloaded the plus operator for adding two complex numbers.

There the two properties named Real and Imaginary has been declared exposing only the required “get” method, while the object’s constructor is demanding for mandatory real and imaginary values with the user defined constructor of the class

Method Overriding:

Method overriding is a language feature that allows a subclass to override a specific implementation of a method that is already provided by one of its super-classes.

A subclass can give its own definition of methods but need to have the same signature as the method in its super-class. This means that when overriding a method the subclass's method has to have the same name and parameter list as the super-class's overridden method.

In above example I have extended the implementation of the sample Complex class given under operator overloading section.

This class has one overridden method named “ToString”, which override the default implementation of the standard “ToString” method to support the correct string conversion of a complex number.

MVC Architecture:

The Model-View-Controller (MVC) architecture separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes

mvc.jpg

  1. Model: DataSet and typed DataSet (some times business object, object collection, XML etc) are the most common use of the model.
  2. View: The ASPX and ASCX files generally handle the responsibilities of the view.
  3. Controllers: The handling of events or the controlling is usually done in the code-behind class.

In a complex n-tier distributed system the MVC architecture place the vital role of organizing the presentation tier of the system.

Difference between Thread and Process.

A thread is the basic unit to which the operating system allocates processor time.

A thread is a path of execution that run on CPU, a process is a collection of threads that share the same virtual memory. A process has at least one thread of execution, and a thread always run in a process context.

Process is an execution of a program and program contains set of instructions but thread is a single sequence stream within the process.
 
Thread is sometime called lightweight process. 
Single thread allows a operating system to perform single task at a time.
 
Similarities between process and threads are: 
·         Share CPU. 
·         Sequential execution 
·         Create child 
·         If one thread is blocked then the next will be start to run like process. 
 
Dissimilarities: 
·         Threads are not independent like process. 
·         All threads can access every address in the task unlike process. 
·         Threads are design to assist or another and process might or not might be assisted on one another.

Thread

Process

Threads share the address space of the process that created it.
Processes have their own address.

Threads have direct access to the data segment (Global variables, Code lines) of its process
Processes have their own copy of the data segment of the parent process
Threads can directly communicate with other threads of its process
Processes must use inter process communication to communicate with sibling processes. 

Threads have almost no overhead

Processes have considerable overhead.

New threads are easily created

New processes require duplication of the parent process.
Threads can exercise considerable control over threads of the same process
processes can only exercise control over 
Child processes. 
Changes to the main thread (cancellation, priority 
change, etc.) may affect the behavior of the other threads of the process
Changes to the parent process does not affect child processes
 
 

Difference between Debug and Release.

Debug

Release

Suppose u have developed a windows application, now u want test it whether it is working or not, for that u need to build your application, here u will be choosing the DEBUG mode because this is not your final application u r still in testing mode itself

Suppose u have developed a windows application, now u want release the application to client , here u will be choosing the RELEASE mode. It’s a final application

In terms of execution speed, a debug executable will execute slower

In terms of execution speed, a release executable will execute faster

In a debug build the complete symbolic debug information is emitted to help while debugging applications and also the code optimization is not taken

While in release build the symbolic debug info is not emitted and the code execution is optimized

If you want the deploy the application in debug mode , it will take more resources on background so it will take more memory.

If you want the deploy the application in release mode , it won’t take more resources.

Difference between Single Call and Single Ton:

Singleton: Same instance of a Server-side object is used by all the clients for all the requests.

Single Call: Whenever a new call is received, a new instance of the Server-side object is created and reference is passed to the client. Therefore, for each call to the server, the client gets a new instance of the object.

Single Call

Single Ton

 
 

Single Call objects service one and only one request coming in.

Single Call objects are useful in scenarios where the objects are required to do a finite amount of work.

Single Call objects are usually not required to store state information and they cannot hold state information between method calls

Singleton objects are those objects that service multiple clients and hence share data by storing state information between client invocations. They are useful in cases in which data needs to be shared explicitly between clients and also in which the overhead of creating and maintaining objects is substantial.

Single call objects can be used when overhead of creating it is insignificant, you do not need to maintain state and server needs to support large number of requests for the object. Because single call objects are created and destroyed with each client request, server resources are only tied up for small length of time.

Singleton object can be used when you need to maintain state over a period of time and several clients need to work on shared basis. There would be just one instance of an object

Difference between Server.Transfer and Response.Redirect:

Server.Transfer

Response.Redirect

Server.Transfer is used when redirecting the webpage within the same application

Response.Redirect is applicable towards the redirection of webpage between 2 applications

Response.Redirect will instruct browser to call a particular webpage. This will increase one request and one response between the client and server

Server. Transfer is only used for aspx pages it will not work for html pages.

Response. Redirect can be used both for aspx and html pages

Server. Transfer if we selected the second attribute to TRUE then it will post the entire variable using the post method.

Response. Redirect will only get method to post variables form one page to another means we need to give in query string if we want to pass some variables to next page

Server. Transfer does not roundtrip

Response. Redirect provides a roundtrip to the server

Server.Transfer can be used only to transfer to other pages of the same web site.

Response.Redirect can be used to redirect to external web sites

Difference between an ADO.NET Dataset and an ADO Record set?

Dataset

Record set

Data set is working in disconnected mode which improves performance of the application

Record set is working in connected mode

Dataset in ado.net will gets more than one table at a time

Record set we will get at any time only one table from the database

We can retrieve data from different databases by using data set

by using record set we can retrieve data from one table

dataset is typesafe

Record set is un typesafe

We can retrieve single data from the multiple tables and make a relation between them(Foreign-key)

We can retrieve single data from the multiple tables by using Joins

Assemblies

  • An Assembly is a logical unit of code
  • Assembly physically exist as DLLs or EXEs
  • One assembly can contain one or more files
  • Assemblies are group of Exes and Dlls

They form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality.

An assembly provides the common language runtime with the information it needs to be aware of type implementations.

3 Types of Assemblies

Private Assembly: This type of assembly is used by a single application. It is stored in the application's directory or the applications sub-directory. There is no version constraint in a private assembly.

Public Assembly: A shared assembly has version constraint. It is stored in the Global Assembly Cache (GAC). To make an assembly a shared assembly, it has to be strongly named. In order to share an assembly with many applications, it must have a strong name.

Satellite Assembly: is an assembly that contains only resources, and no code. The resources are location specific. A satellite assembly is associated with a main assembly, the one that actually contains the code.

Difference between Exe and Dll

Exe

Dll

Extensible Execute File

Dynamic Link Library

.exe use by End User like-Client

.Dll cannot use by End User.

We can Run the .exe

but we cannot Run the .Dll

An EXE can run independently

DLL will run within an EXE

EXE is an out-process file

DLL is an in-process file

Strong Name

The Strong Name tool helps sign assemblies with strong names. [It can be applicable for public assemblies]

Web.Config:

An Asp .net application has one web.config file which keeps the configurations required for the corresponding application. Web.config file is written in XML with specific tags having specific meanings.

Machine.Config:

As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.

View State:

· View State is pretty good for storing simple values for use in the form.

· View state is a built-in structure for automatically retaining values among multiple requests for the same page.

· The view state is internally maintained as a hidden field on the page

· It providing greater security because of the values in view state are hashed, compressed, and encoded, thus representing a higher state of security

· View State values are not carried between pages

Navigation controls:

It is used for navigation of the pages

  • Dynamic menus
  • TreeViews
  • Site Map Path

Difference between Ado and Ado.Net:

ADO

ADO.Net

ADO works with connected data. This means that when you access data, such as viewing and updating data, it is real-time, with a connection being used all the time.

ADO.NET uses data in a disconnected fashion. When you access data, ADO.NET makes a copy of the data using XML. ADO.NET only holds the connection open long enough to either pull down the data or to make any requested updates.

ADO has one main object that is used to reference data, called the Record set object. This object basically gives you a single table view of your data, although you can join tables to create a new set of records

ADO.NET, you have various objects that allow you to access data in various ways. The Data Set object will actually allow you to store the relational model of your database

ADO allows you to create client-side cursors only

ADO.NET gives you the choice of either using client-side or server-side cursors

In ADO.NET, classes actually handle the work of cursors.

This allows the developer to decide which is best.

For Internet development, this is crucial in creating efficient applications

Whereas ADO allows you to persist records in XML format,

ADO.NET allows you to manipulate your data using XML as the primary means

Asp.Net Life Cycle:

Page request: The page request occurs before the page life cycle begins. When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled or whether a cached version of the page can be sent in response without running the page.

Start: In the start step, page properties such as Request and Response are set. At this stage, the page also determines whether the request is a postback or a new request and sets the IsPostBack property.

Page initialization: During page initialization, controls on the page are available and each control's UniqueID property is set. Any themes are also applied to the page.

Load: During load, if the current request is a postback, control properties are loaded with information recovered from view state and control state.

Validation: During validation, the Validate method of all validator controls is called, which sets the IsValid property of individual validator controls and of the page.

Postback event handling: If the request is a postback, any event handlers are called.

Rendering: Before rendering, view state is saved for the page and all controls. During the rendering phase, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream of the page's Response property.

Unload: Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed.

Constructors

A constructor is a special type of method that is invoked automatically when an object is created. Constructors allow you to specify starting values for properties, and other such initialization details.

Classes in Ado.Net

We can divide the ADO.NET classes into provider and consumer objects.

Provider objects are each type of data source, the actual reading and writing to and from data source is done with the provider-specific objects.

Consumer objects are tools that we use to access and manipulate the data after we have read it into memory. The consumer objects work in disconnected mode.

Provider Objects

Connection Object

Commander Object

Command Builder Object

DataReader Object

Data Adapter Object

Consumer Objects

Dataset Objects

DataTable

DataColumn

DataRow

Delegates and Events

Delegates are the like pointer to the event it only point to the event and that event get fire
like we can say use can raise event even without that event happen.

Events are the actions of the system on user manipulations (e.g. mouse clicks, key press, timer etc.) or any event triggered by the program.


Delegate is type which holds the method(s) reference in an object. It is also referred as a type safe function pointers

Event is Arraylist of delegates.
* Delegate can fire only one method

But Event fire more than one delegate, each call one method.

Protected Friend and Friend.

Friend --> Accessible ONLY by 1.Derived classes 2.Classes 
in the same assembly 3.Within the same class
 
Protected Friend --> Accessible ONLY by 1.Derived classes 
2.Classes in the same assembly 3.Within the same class

--last record

select top 1 * from tblhobbies order by hobbiesid desc

--last two records

select top 2 * from tblhobbies Order by hobbiesid desc

-- second row from top

with tblrows as

(select row_number() over (order by hobbiesid) as row_num,* from tblhobbies )

select * from tblrows where row_num =2

-- second row from bottom

select * from tblhobbies where hobbiesid =(SELECT MIN(hobbiesid) FROM tblhobbies

WHERE hobbiesid IN

(SELECT TOP 2 hobbiesid FROM tblhobbies ORDER BY hobbiesid DESC))

--Nth Highest salary

SELECT DISTINCT (a.hobbiesid) FROM tblhobbies A WHERE n = (SELECT COUNT (DISTINCT (b.hobbiesid)) FROM tblhobbies B WHERE a.hobbiesid<=b.hobbiesid);

Sealed class

Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as sealed class, this class cannot be inherited.

In Visual Basic .NET, NotInheritable keyword serves the purpose of sealed.

using System;
class Class1
{
static void Main(string[] args)
{
SealedClass sealedCls = new SealedClass();
int total = sealedCls.Add(4, 5);
Console.WriteLine("Total = " + total.ToString());
}
}
// Sealed class
sealed class SealedClass
{
public int Add(int x, int y)
{
return x + y;
}
}

How to inherit the static class a in derived class b(syntax declaration)

Static class inheritance is not the way to go: It is the wrong mechanism to use, and works only for static members that happen to reside in a static class.

Joins using Linq:

Inner Join

var q = from c in customers
            join o in orders on c.Key equals o.Key
            select new {c.Name, o.OrderNumber};
 
“Var” data type in asp.net
 
·         C# 3.0 adds the interesting behavior of Declaring Local Variables Implicitly
·         This means that there is no need to mention the data type when declaring    a variable.
·         A local variable can be declared implicitly using the var keyword in C#.
·         Declaring local variables implicitly has some restrictions; the variable must be initialized to some expression that can not be null.


var a= 10;
var z = "Rekha";
 
 
 
 
Difference between Typed and Untyped Dataset
 
Typed Dataset
UnTyped Dataset
Typed datasets give you nice automatically-generated

classes with properties and method suited exactly for your needs
Untyped dataset you have to follow the database structure. The database

tells you what to do. The select statements may return much more columns
that you need, or with different names
MyTypedDataSet.MyDoctor.FirstName = "Fred"
MyUntypedDataSet.Tables("Doctors").Row(0).Item(1)= "Fred"
the dataset which follows the unstructure is called as Unstructured dataset
dataset can be inherited from dataset class by providing strongly typed properties and methods
 
 
 
 
 
Stored Procedure:
 
In a database management system (DBMS), a stored procedure is a set of Structured Query Language (SQL) statements with an assigned name that's stored in the database in compiled form so that it can be shared by a number of programs.
 
Function
Stored Procedure
1. Should return at least one output parameter. Can return more than one parameter using OUT argument.
1. Doesn't need to return values but can return value.
2. Parsed and compiled at runtime.
2. Stored as a pseudo-code in database i.e. compiled form.
3. Cannot affect the state of database.
3.Can affect the state of database using commit etc.
4. Can be invoked from SQL statement e.g. SELECT.
4. Cannnot be invoked from SQL statements e.g. SELECT.
5. Functions are mainly used to compute values.
5. Procedures are mainly used to process the tasks.
 
 
 
Truncate and Delete
 
Truncate is faster operation to over the delete
Deletion of each row gets logged and physically deleted.
 
TRUNCATE will reset any identity columns to the default seed value.  This means if you have a table with an identity column and you have 264 rows with a seed value of 1, your last record will have the value 264 (assuming you started with value 1) in its identity columns.  After TRUNCATEing your table, when you insert a new record into the empty table, the identity column will have a value of 1.  DELETE will not do this.  In the same scenario, if you DELETEd your rows, when inserting a new row into the empty table, the identity column will have a value of 265.
 
 
Ajax:
 
AJAX (Asynchronous JavaScript and XML) is a web development technique for creating interactive web applications. 
It allows content on a page to refresh without refreshing the entire page. 
This allows one section of page to stay up to date by getting new information regularly at a set frequency without the need for the website visitor to keep refreshing the entire page.

What AJAX is made up of:

  • XHTML (or HTML) is used for marking up content and displaying text and images in a web browser (such as Firefox, Opera, or Internet Explorer).
  • XML, preformatted HTML, plain text, JSON can also work with AJAX
  • CSS and styling information. CSS stands for Cascading Style Sheets and is used to "style" a webpage
  • The DOM (Document Object Model) manipulated through JavaScript to dynamically display and interact with the information presented
  • The XMLHttpRequest object to exchange data asynchronously with the web server. In some Ajax frameworks and in some situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server.

What is an AJAX application?

Ajax applications, can send requests to the web server to retrieve only the data that is needed, and may use SOAP or some other XML-based web services dialect.

On the client, JavaScript processes the web server's response, and may then modify the document's content through the DOM to show the user that an action has been completed.

The result is a more responsive application, since the amount of data interchanged between the web browser and web server is vastly reduced. Web server processing time is also saved, since much of it is done on the client.

 
Without the use of update panel how could you call the page post back event in Ajax?
 
By using xmlHttpRequest and callback function ()
 
Syntax:
 
function ajax_request() {

// ...
xhrobj.onreadystatechange = function ajax_response() {
// ...
responseCallback(xhr);
xhr.send( );
 


}
}



function callback() {
    if (req.readyState == 4) {
        if (req.status == 200) {
            // update the HTML DOM based on whether or not message is valid
        }
    }
}
 
 
 

How do we sort the data in dataset

Code Example:


SqlConnection cn;

cn=new SqlConnection(ConnectionString);
cn.Open();
SqlDataAdapter da;
DataSet ds=new DataSet();
da=new SqlDataAdapter("select emp_id, fname, lname from employee",cn);
da.Fill(ds);
DataView dtView = ds.Tables[0].DefaultView;
dtView.Sort = "fname ASC";
DataGrid1.DataSource=dtView;
DataGrid1.DataBind();
 
 
 
Also Here is a little method I used to sort a datatable:
 
 /// The DataTable to be sorted.
 /// A way to filter out certain rows from the table.
 /// A way to sort the table (i.e. "State IN 'CA'")
 /// A Sorted/Filtered DataTable
 public static DataTable FilterSortData(DataTable dtStart, string filter, string sort)
 {
 DataTable dt = dtStart.Clone();
 DataRow[] drs = dtStart.Select(filter, sort);
 foreach (DataRow dr in drs)
 {
 dt.ImportRow(dr);
 }
 return dt;
 }
 
 
Difference between 2.0 and 3.0 and 3.5

2.0 = framework that shipped with VS 2005 VB 8.0 / C# 2.0

3.0 = same framework as 2.0 + WCF + WPF + WF

3.5 = all the above + LINQ technologies and will ship with the next VS including VB 9.0 and C# 3.0, SharePoint sequential and state machine work flows

 
 
Self Join
 
Self-join to simplify nested SQL queries where the inner and outer queries reference the same table. These joins allow you to retrieve related records from the same table.
 
Example:
SELECT e.first_name AS 'Employee FN', e.last_name AS 'Employee LN', m.first_name AS 'Manager FN', m.last_name AS 'Manager LN'

FROM employees AS e LEFT OUTER JOIN employees AS m
ON e.manager =m.id
 
 
 
Functions and Sub Routines in VB.Net
 

1. VB.Net Subroutine is faster than Function

2. You should never use a Function without a return type, it wont give you a compilation error but it hinders the performance.

Multi file assembly extension
 
.netmodule
(http://msdn.microsoft.com/en-s/library/168k2ah5%28VS.71%29.aspx)
 
How can we get environment temp directory
system.io.path.gettemppath()
(http://edn.embarcadero.com/article/32384)
[using "environment"] Environment.GetEnvironmentVariable("TEMP");
 
Conversion from .net data type to xml data type
using "xmlconvert"
 
How to set connection pool
initial catalog=Northwind; Data Source=localhost; Connection Timeout=30; 
User Id=MYUSER; Password=PASSWORD; Min Pool Size=20; Max Pool Size=200; 
Incr Pool Size=10; Decr Pool Size=5;
 
 
How to get distinct rows in datatable.defaultview
datatable.defaultview.totable(true,columnslist)
 
How to set the asynchronous mode to connection string
private void Execute(string connectionstring)
{
    SqlConnection connection =     new SqlConnection(connectionstring + "async=true;");
 
    SqlCommand command =    new SqlCommand("MyStoredProcedure", connection);
 
    command.CommandType = CommandType.StoredProcedure; 
 
    connection.Open();
 
    command.BeginExecuteReader(Asynchronous, command,  CommandBehavior.CloseConnection);
}
 
What steps you are created for globalization
 
Which setup project to install activex controls in web applications
 
How to know the user in particular role using membership control
User.IsInRole("managers") 
 
Which modifier used by default event handlers
protected
 
How to get the last error
Server.GetLastError().ToString()
 
How to clear the error messages
server.clearError();
 
How to know the longest running event in page life cycle
 
How to overloading the methods in web service
[WebMethod(MessageName = "AddInt", Description = "Add two integer 
        Value", EnableSession = true)] 
http://www.codeproject.com/KB/webservices/OverloadingInWebService.aspx
 
What is the output below program:
for (; ; )
            {
                Console.WriteLine ("text");
            }
Ans: Infinite loop
 
 
How to set the code access security for particular users
Using .net framework configuration wizard or
using  command prompt wizard "caspol.exe"
http://www.codeproject.com/KB/security/UB_CAS_NET.aspx