SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
LATEST DOT NET INTERVIEW QUESTIONS


What are Design Patterns?

A Design Pattern essentially consists of a problem in a software design and a solution to the same. In

Design Patterns each pattern is described with its name, the motivation behind the pattern and its

applicability.

According to MSDN, "A design pattern is a description of a set of interacting classes that provide a

framework for a solution to a generalized problem in a specific context or environment. In other words, a

pattern suggests a solution to a particular problem or issue in object-oriented software development.

Benefits of Design Patterns

The following are some of the major advantages of using Design Patterns in software development.

·   Flexibility         ·   Adaptability to change                 ·   Reusability

When to use Design Patterns

Design Patterns are particularly useful in one of the following scenarios.

· When the software application would change in due course of time.

· When the application contains source code that involves object creation and event notification.

When not to use Design Patterns

. Do not use design patterns in any of the following situations.

· When the software being designed would not change with time.

· When the requirements of the source code of the application are unique.

If any of the above applies in the current software design, there is no need to apply design patterns in the

current design and increase unnecessary complexity in the design.

The Gang of Four (GOF) Patterns

The invention of the design patterns that we commonly use today can be attributed to the following four

persons: Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. These men invented 23 patterns in

all that are commonly known as the Gang of Four patterns or the GOF patterns.

·       Creational               ·     Structural                  ·       Behavioral

Each of these groups in turn contains related sub patterns.

Creational Patterns

The Creational Patterns deals with the best possible way of creating an object or an instance of a class.

They simplify object creation and provide a flexible approach towards object creation. The following are the

sub-patterns that fall under this group.

·   Abstract Factory    · Factory          ·   Builder   · Prototype        · Singleton



Both the Abstract Factory and the Factory pattern have the same intent.
The Singleton Pattern indicates that there can be only one instance of a class throughout the Application’s

life cycle. A singleton class is one that can be instantiated only once in the application domain and provides

a global point of access to it.



Structural Patterns

Structural Patterns provides the flexibility to specify how objects and classes can interoperate. The following

are the sub patterns that comprise the Structural Patterns group.

·      Adapter           ·        Façade         ·     Bridge             ·      Composite

·      Decorator         ·        Flyweight      ·     Proxy              ·      Adapter

·      Bridge            ·        Composite      ·     Decorator          ·      Flyweight

·      Proxy

Behavioral Patterns

Behavioral patterns help you define a structure for inter-object communication between objects in your

system. This design pattern is typically used to monitor the messages that are transmitted when the objects

communicate in a system. The following are the sub patterns under Behavioral Patterns.

·      Chain of Responsibility             ·     Command         ·        Interpreter      ·       Iterator

·      Mediator                   ·        Memento      ·       Observer          ·        State

·      Strategy          ·        Template Method       ·       Visitor


ASP.NET MVC is a framework that allows developers to apply the MVC pattern in the development of an
ASP.NET application, thus allowing a better separation of concerns, which results in better reusability and
easier testing.

MVC consists of three kinds of objects

The Model is an application object.

The View is the screen presentation.

The controller defines the way the user interface reacts to user inputs

•   The request comes from the client and hits the Controller.
•   The Controller calls the Model in order to perform some "business" operations.
       •   The Model returns the results of the operations back to the Controller.
       •   The Controller decides which View needs to be rendered and sends it the data that must be
           rendered.
    •  Finally the View renders the output and sends the response back to the client.

What is Cryptography?

Cryptography is used to protect data and has many valuable uses. It can protect data from being viewed,
modified, or to ensure the integrity from the originator. Cryptography can be used as a mechanism to
provide secure communication over an unsecured network, such as the Internet, by encrypting data, sending
it across the network in the encrypted state, and then the decrypting the data on the receiving end.
Encryption can also be used as an additional security mechanism to further protect data such as passwords
stored in a database to prevent them from being human readable or understandable.

Encryption Components
Encryption involves the use of a cryptography algorithm combined with a key to encrypt and decrypt the
data. The goal of every encryption algorithm is to make it as difficult as possible to decrypt the data without
the proper key. Data is translated from its originating form into something that appears meaningless unless
the proper algorithm and key are used to decrypt the data.

The Microsoft .NET Framework classes (System.Security.Cryptography) will manage the details of
cryptography for you. The classes are implemented with the same interface; so working with the classes is
the same across the cryptography namespace.

Public-Key Encryption

Public-key encryption, also known as asymmetric encryption, uses a public and private key pair to encrypt
and decrypt data. The public key is made available to anyone and is used to encrypt data to be sent to the
owner of the private key. The private key, as the name implies, is kept private. The private key is used to
decrypt the data and will only work if the correct public key was used when encrypting the data. The private
key is the only key that will allow data encrypted with the public key to be decrypted. The keys can be
stored for use multiple times, or generated for a one-time use.

Asymmetric encryption algorithms are usually efficient for encrypting small amounts of data only. The
following public-key algorithms are available for use in the .NET Framework.

Digital Signature Algorithm (DSA)

RSA

Private-Key Encryption

Private-key Encryption, also known as symmetric encryption, uses a single key to encrypt and decrypt
information. The key must be kept secret from those not authorized to decrypt the data lest the data be
compromised. Private-key algorithms are relatively fast and can be used to encrypt and decrypt large
streams of data. Private-key algorithms are known as block ciphers because they encrypt data one block at a
time. A block cipher will encrypt the same input block into the same output block based on the algorithm and
key. If the anything were known about the structure of the data, patterns could be detected and the key
could possibly be reverse engineered. To combat this, the classes in the .NET Framework use a process
known as chaining where information from the previous block is used in encrypting the current block. This
helps prevent the key from being discovered. It requires an initialization vector (IV) be given to encrypt the
first block of data.

The following private-key algorithms are available in the .NET Framework. Each description contains some
basic information about each algorithm, including the strengths and weaknesses.

Data Encryption Standard (DES) algorithm encrypts and decrypts data in 64-bit blocks, using a 64-bit key.
Even though the key is 64-bit, the effective key strength is only 56-bits. There are hardware devices
advanced enough that they can search all possible DES keys in a reasonable amount of time. This makes the
DES algorithm breakable, and the algorithm is considered somewhat obsolete.

RC2 is a variable key-size block cipher. The key size can vary from 8-bit up to 64-bits for the key. It was
specifically designed as a more secure replacement to DES. The processing speed is two to three times
faster than DES. However, the RC2CryptoServiceProvider available in the .NET Framework is limited to 8
characters, or a 64-bit key. The 8-character limitation makes it susceptible to the same brute force attack as
DES.

TripleDES algorithm uses three successive iterations of the DES algorithm. The algorithm uses either two or
three keys. Just as the DES algorithm, the key size is 64-bit per key with an effective key strength of 56-bit
per key. The TripleDES algorithm was designed to fix the shortcomings of the DES algorithm, but the three
iterations result in a processing speed three times slower than DES alone.

Rijndael algorithm, one of the Advanced Encryption Standard (AES) algorithms, was designed as a
replacement for the DES algorithms. The key strength is stronger than DES, and was designed to out
perform DES. The key can vary in length from 128, 192, to 256 bits in length. This is the algorithm I
personally trust the most and that I'll use for the examples contained in the column.

Hashing Algorithms

No, I'm not talking about some type of drug related activity or an extra special recipe for brownies. Hashing
refers to mapping data of any length into a fixed-length byte sequence. Regardless of if the input is the
contents of the library of Congress or the typing test "The quick brown fox jumps over the lazy dog" it will
result in an output of the same size. Hashing also produces unique results. Just as no two snowflakes are
identical, no two combinations of input will produce the same hash output. Even if the input varies by a
single character it will produce different output. The .NET Framework provides support for the following hash
algorithms of which I'll leave it up to you to discover which one is right for you based on the size of the data
you require.

HMACSHA1        MACTripleDES            MD5CryptoServiceProvider         SHA1Managed

SHA256Managed           SHA384Managed           SHA512Managed

How to Generate a Key and IV for Private-key Encryption

Each algorithm has specific key sizes that it expects for use. Each key must fit a predetermined size typically
ranging from 1 character (8-bit) up to 32 characters (256-bit). Some of the algorithms support varying key
sizes, but they must be within the valid ranges of key size for the particular algorithm. For our purposes,
we'll use Rijndael, which supports 128, 192, and 256 bit keys. The way to generate a 128-bit key for use is
through one of the hashing algorithms. A phrase, or "secret" of any length can be hashed to generate a key
of the required size for encrypting data. The following code outlines a class containing a method that takes
an input phrase and generates a key and IV for use.

Using Encryption to Protect Sensitive Data Stored in a Database

This brings us to a possible and often overlooked use for encryption, which is encrypting data such as
passwords that are stored in a database. There are several benefits to storing sensitive data such as
passwords in encrypted format.

It keeps sensitive application data such as passwords secret from those authorized to view data that ideally
should not be able to see application specific data such as passwords.

It keeps passwords protected from unauthorized access. If the database is somehow compromised, the
intruder must now the correct algorithm and key to decrypt the sensitive data.

Passing direct input to a query is dangerous because you never know what the input may contain. Suppose a
stored procedure including something like "WHERE vc_Login = @Login and Password = @Password" is used
for authentication. A user name of "'m' or 1=1" with the same for the password could evaluate to a true
statement and result in incorrectly allowing access. If the user id and or password were stored encrypted
then the data would not evaluate to a valid SQL statement because an encrypted form of the statement
would be used in the evaluation.


22 New Features of Visual Studio 2008 for .NET Professionals


1. LINQ Support

LINQ essentially is the composition of many standard query operators that allow you to work with data in a
more intuitive way regardless.

The benefits of using LINQ are significant – Compile time checking C# language queries, and the ability to
debug step by step through queries.

2. Expression Blend Support
Expression blend is XAML generator tool for silverlight applications. You can install Expression blend as an
embedded plug-in to Visual Studio 2008. By this you can get extensive web designer and JavaScript tool.

3. Windows Presentation Foundation

WPF provides you an extensive graphic functionality you never seen these before. Visual Studio 2008
contains plenty of WPF Windows Presentation Foundation Library templates. By this a visual developer who
is new to .NET, C# and VB.NET can easily develop the 2D and 3D graphic applications.

Visual Studio 2008 provides free game development library kits for games developers. currently this game
development kits are available for C++ and also 2D/3D Dark Matter one image and sounds sets.

4. VS 2008 Multi-Targeting Support

Earlier you were not able to working with .NET 1.1 applications directly in visual studio 2005. Now in Visual
studio 2008 you are able to create, run, debug the .NET 2.0, .NET 3.0 and .NET 3.5 applications. You can
also deploy .NET 2.0 applications in the machines which contains only .NET 2.0 not .NET 3.x.

5. AJAX support for ASP.NET

Previously developer has to install AJAX control library separately that does not come from VS, but now if
you install Visual Studio 2008, you can built-in AJAX control library. This Ajax Library contains plenty of rich
AJAX controls like Menu, TreeView, webparts and also these components support JSON and VS 2008
contains in built ASP.NET AJAX Control Extenders.

6. JavaScript Debugging Support

Since starting of web development all the developers got frustration with solving javascript errors.
Debugging the error in javascript is very difficult. Now Visual Studio 2008 makes it is simpler with javascript
debugging. You can set break points and run the javaScript step by step and you can watch the local
variables when you were debugging the javascript and solution explorer provides javascript document
navigation support.

7. Nested Master Page Support

Already Visual Studio 2005 supports nested master pages concept with .NET 2.0, but the problem with this
Visual Studio 2005 that pages based on nested masters can't be edited using WYSIWYG web designer. But
now in VS 2008 you can even edit the nested master pages.

8. LINQ Intellisense and Javascript Intellisense support for silverlight applications

Most happy part for .NET developers is Visual Studio 2008 contains intellisense support for javascript.
Javascript Intellisense makes developers life easy when writing client side validation, AJAX applications and
also when writing Silverlight applications

Intellisense Support: When we are writing the LINQ Query VS provides LINQ query syntax as tool tips.

9. Organize Imports or Usings

We have Organize Imports feature already in Eclipse. SInce many days I have been waiting for this feature
even in VS. Now VS contains Organize Imports feature which removes unnecessary namespaces which you
have imported. You can select all the namespaces and right click on it, then you can get context menu with
Organize imports options like "Remove Unused Usings", "Sort Usings", "Remove and Sort". Refactoring
support for new .NET 3.x features like Anonymous types, Extension Methods, Lambda Expressions.

10. Intellisense Filtering

Earlier in VS 2005 when we were typing with intellisense box all the items were being displayed. For
example If we type the letter 'K' then intellisense takes you to the items starts with 'K' but also all other
items will be presented in intellisense box. Now in VS 2008 if you press 'K' only the items starts with 'K' will
be filtered and displayed.
11. Intellisense Box display position

Earlier in some cases when you were typing the an object name and pressing . (period) then intellisense was
being displayed in the position of the object which you have typed. Here the code which we type will go back
to the dropdown, in this case sometimes programmer may disturb to what he was typing. Now in VS 2008 If
you hold the Ctrl key while the intellisense is dropping down then intellisense box will become semi-
transparent mode.

12. Visual Studio 2008 Split View

VS 205 has a feature show both design and source code in single window. but both the windows tiles
horizontally. In VS 2008 we can configure this split view feature to vertically, this allows developers to use
maximum screen on laptops and wide-screen monitors.

Here one of the good feature is if you select any HTML or ASP markup text in source window automatically
corresponding item will be selected in design window.

13. HTML JavaScript warnings, not as errors:

VS 2005 mixes HTML errors and C# and VB.NET errors and shows in one window. Now VS 2008 separates
this and shows javascript and HTML errors as warnings. But this is configurable feature.

14. Debugging .NET Framework Library Source Code:

Now in VS 2008 you can debug the source code of .NET Framework Library methods. Lets say If you want to
debug the DataBind() method of DataGrid control you can place a debugging point over there and continue
with debug the source code of DataBind() method.

15. In built Silverlight Library

Earlier we used to install silverlight SDK separately, Now in VS 2008 it is inbuilt, with this you can create,
debug and deploy the silverlight applications.

16. Visual Studio LINQ Designer

Already you know in VS 2005 we have inbuilt SQL Server IDE feature. by this you no need to use any other
tools like SQL Server Query Analyzer and SQL Server Enterprise Manger. You have directly database
explorer by this you can create connections to your database and you can view the tables and stored
procedures in VS IDE itself. But now in VS 2008 it has View Designer window capability with LINQ-to-SQL.

17. Inbuilt C++ SDK

Earlier It was so difficult to download and configure the C++ SDK Libraries and tools for developing windows
based applications. Now it is inbuilt with VS 2008 and configurable

18. Multilingual User Interface Architecture - MUI

MUI is an architecture contains packages from Microsoft Windows and Microsoft Office libraries. This
supports the user to change the text language display as he wish.

Visual Studio is now in English, Spanish, French, German, Italian, Chinese Simplified, Chinese Traditional,
Japanese, and Korean. Over the next couple of months. Microsoft is reengineering the MUI which supports
nine local languages then you can even view Visual studio in other 9 local languages.

19. Microsoft Popfly Support

Microsoft Popfly explorer is an add-on to VS 2008, by this directly you can deploy or hosting the Silverlight
applications and Marshup objects

Deployment Options Supported by .NET

You can deploy an ASP.NET Web application using any one of the following three deployment options.
XCOPY Deployment
Using the Copy Project option in VS .NET
Deployment using VS.NET installer

XCOPY Deployment

Before looking at how .NET enables XCOPY deployment, let us take a moment to understand what XCOPY
deployment is. Prior to .NET, installing a component (for example, a COM Component) required copying the
component to appropriate directories, making appropriate registry entries, and so on. But now in .NET, to
install the component all you need to do is copy the assembly into the bin directory of the client application
and the application can start using it right away because of the self-describing nature of the assembly. This
is possible because compilers in the .NET Framework embed identifiers or meta-data into compiled modules
and the CLR uses this information to load the appropriate version of the assemblies. The identifiers contain
all the information required to load and run modules, and also to locate all the other modules referenced by
the assembly. It is also refered to as zero-impact install since the machine is not impacted by way of
configuring the registry entries and configuring the component. This zero-impact install also makes it
possible to uninstall a component without impacting the system in any manner. All that is required to
complete uninstallation is the removal of specific files from the specific directory. For performing this type of
deployment, all you need to do is to go to the Command Prompt and copy over the required files to a
specific directory on the server using the XCOPY command.

As you can see, the XCOPY command takes a number of arguments.

/ E - This option copies directories, subdirectories, and files of the source argument, including empty ones.
/ K - This option allows you to retain all the existing file and folder attributes. When you use XCOPY to copy
files or a directory tree structure, XCOPY strips off file attributes by default. For example, if a file had the
read-only attribute set, that attribute would be lost after the file is copied. To retain the original attributes
with the copied files, you must use the / K parameter.
/ R - This option overwrites files marked as read only.
/ O - This option preserves all security-related permission ACLs of the file and folders.
/ H - This option copies both hidden and system files.
/ I - This option tells XCOPY to assume that the destination is a directory and create it if it does not already
exist.

Once the folder is copied over to the target server, you then need to create a virtual directory on the target
server (using Internet Information Manager MMC snap-in) and map that virtual directory to the physical
directory that is created using the XCOPY command. That's all there is to deploying an ASP.NET Web
application on a remote server using XCOPY Deployment.

Using the Copy Project Option in VS .NET
The Copy Project option in VS .NET makes it very easy to deploy ASP.NET Web applications onto the target
servers. Using this option, you can copy the Web project to the same server or to a different server.

If you are using VS .NET to develop Web applicatons, the first thing that you need to do before packaging an
ASP.NET Web applications is to change the Active Solution Configuration from Debug to Release as shown
below. This allows the compiler not only to optimize the code but also remove the debugging related
symbols from the code, making the code run much faster. To bring up the Configuration Manager, select
your Web project from the Solution Explorer and select Project->Properties->Configuration Properties from
the menu and then click on the Configuration Manager Command button. In the Active Solution
Configuration combo box, select the Release option.

To copy the Web project onto the target server, select Project->Copy Project from the menu. Selecting that
option will result in the following dialog box being displayed.

The Copy Project dialog provides the following options.

Destination Project Folder: Using this option, you can specify the location to which you want to copy the
project. The location can be the same server or a remote server.
Web access method: The Web access method option determines the access method that is used to copy the
Web project to the destination folder. There are two types of Web access methods.
File share: This option indicates that you want to directly access your project files on the Web server through
a file share. It does not require FrontPage Server Extensions on the server.
FrontPage: This option specifies that you want to use the HTTP-based FrontPage Server Extensions to
transfer your project files to the server. Before using this option, make sure FrontPage Server Extensions are
installed on the server. This option will automatically create the required virtual directory on the target
server.
Copy: The Copy option provides three types:
Only files needed to run this application: this option copies built output files (DLLs and references from the
bin folder) and any content files (such as .aspx, .asmx files). Most of the time, you should be able to deploy
the application using this default option.
All project files: this option copies built outputs (DLLs and references from the bin folder) and all files that
are in the project. This includes the project file and source files.
All Files in the source project folder: choosing this option will result in all the project files and any other files
that are in the project folder (or subfolder) being transferred to the destination folder.

To copy the Web project, select the appropriate options from the above Copy Project dialog box and click

OK. This will result in the ASP.NET Web application being deployed on the target server.

Deployment Using VS .NET Web Setup Project

Even though XCOPY deployment and Copy Project options are very simple and easy-to-use, they do not lend
themselves well to all of the deployment needs. For example, if your application requires more robust
application setup and deployment requirements, VS .NET installer can be the right choice. Although you can
distribute your Web application as a collection of build outputs, installer classes, and database creation
scripts, it is often easier to deploy complex solutions with Windows Installer files. VS .NET provides Web
setup projects that can be used to deploy Web applications. These Web setup projects differ from standard
setup projects in that they install Web applications to a virtual root folder on a Web server rather than in the
Program Files folder, as is the case with the applications installed using standard setup projects.

Since VS .NET installer is built on top of Windows Installer technology, it also takes advantages of Windows

Installer features. Before starting on a discussion of VS .NET Web Setup Project, let us understand the

architecture of Windows Installer technology that provides the core foundation on top of which the VS .NET

installer is built.


Features Provided by VS .NET Web Setup Project

The deployment project in VS .NET builds on features of the Windows installer by allowing us to perform the
following operations.

Reading or writing of registry keys
Creating directories in the Windows file system on the target servers
Provides a mechanism to register components
Provides a way to gather information from the users during installation
Allows you to set launch conditions, such as checking the user name, computer name, current operating
system, software application installed, presence of .NET CLR and so on.
Also makes it possible to run a custom setup program or script after the installation is complete.
In the next section, we will see how to deploy our DeploymentExampleWebApp using the VS .NET Web
Setup Project.

Creating a Web Setup Project Using VS .NET Installer

We will start by adding a new Web Setup Project to our DeploymentExampleWebApp ASP.NET Web
application solution by selecting File->Add Project-> New Project from the menu. In the New Project dialog
box, select Setup and Deployment Projects from the Project Types pane and then select Web Setup Project
in the Templates pane as shown in the following figure.

After creating the project, you then need to add the output of the primary assembly and the content files of
the ASP.NET Web application to the setup project. To do this, right click on the
DeploymentExampleWebAppSetup project in the solution explorer and select Add->Project Output from the
context menu. In the Add Project Output Group dialog box, select DeploymentExampleWebApp from the
Project combo box and select Primary Output from the list.
After adding the project output, you then need to add the related Content Files (such as .aspx files, Images,
and so on) to the project. To do this, again bring up the Add Project Output dialog box and then select
Content Files from the list this time. It is illustrated in the following screenshot.

After adding the Primary output and the Content Files to the Web Setup project, the solution explorer looks
as follows:

Configuring Properties through the Properties Window

There are a number of properties that you can set through the properties window of the Web Setup project.
These properties determine the runtime display and behavior of the Windows installer file. To accomplish
this, right click on the DeploymentExampleWebAppSetup project from the solution explorer and select
Properties from the context menu to bring up its properties window. The dialog box shown below appears in
the screen.

As can be seen from the above screenshot, the properties window provides properties such as Author,
Description, Manufacturer, Support Phone and so on that can be very useful to the users (who are installing
your application) of your application to get more details about your application.

Installing the ASP.NET Web Application

Once you have created the Windows installer file (.msi file), then installing the ASP.NET application in the
target servers is very straightforward. All you need to do is to double-click on the .msi file from the Windows
explorer. This will initiate the setup wizard, which will walk you through the installation steps. The following
screenshot shows the first dialog box displayed during the installation.

Clicking on Next in the above dialog box results in the following dialog box, where you can specify the virtual
directory that will be used to host this Web application. This is one of the handy features wherein the
creation of virtual directory is completely automated obviating the need for manual intervention. In part two
of this article, we will see how to set specific properties (such as Directory Security, Default Document and
so on) on the virtual directory as part of the installation process.

In the above dialog box, you can also click on the Disk Cost... command button to get an idea of the space
required for installing this Web application. Clicking on Next in the above dialog box results in the following
dialog box where you are asked to confirm the installation.

When you click on Next in the above dialog box, the installation will begin and the application will be
installed. If the application is successfully installed, you will see the following dialog box.

After installing the application, you can see the installed ASP.NET application through the Add/Remove
Programs option (that can be accessed through Start->Settings->Control Panel) in your computer. From
here, you can run the setup program to uninstall the application any time you want to.

                                                    Caching

The ability to store data in the main memory and then allow for retrieval of the same as and when they are
requested.
Caching is a technique of persisting the data in memory for immediate access to requesting program calls.

ASP.NET supports three types of caching for Web-based applications:

    1.   Page Level Caching (called Output Caching)
    2.   Page Fragment Caching (often called Partial-Page Output Caching)
    3.   Programmatic or Data Caching

Output Caching

Output caching caches the output of a page (or portions of it) so that a page's content need not be
generated every time it is loaded.

In a typical ASP.NET page, every time the user views the page, the Web server will have to dynamically
generate the content of the page and perform the relevant database queries (which are a very expensive
task to do).
Considering the fact that the page does not change for a certain period of time, it is always a good idea to
cache whatever is non-static so that the page can be loaded quickly.

In Page Output Caching, the entire page is cached in memory so all the subsequent requests for the same
page are addressed from the cache itself.

In Page Fragment Caching, a specific a portion of the page is cached and not the entire page. Page Output or
Fragment Caching can be enabled or disabled at the Page, Application or even the Machine levels.

Data Caching allows us to cache frequently used data and then retrieve the same data from the cache as
and when it is needed. We can also set dependencies so that the data in the cache gets refreshed whenever
there is a change in the external data store. The external data store can be a file or even a database.
Accordingly, there are two types to dependencies, namely, file based and Sql Server based. There are also
differing cache expiration policies

Syntax: <%@ OutputCache Duration="60" VaryByParam="none" %>

The above syntax specifies that the page be cached for duration of 60 seconds and the value "none" for
VaryByParam* attribute makes sure that there is a single cached page available for this duration specified.

* VaryByParam can take various "key" parameter names in query string. Also there are other attributes like
VaryByHeader, VaryByCustom etc.

The following is the complete syntax of page output caching directive in ASP.NET.

<%@ OutputCache Duration="no of seconds"
Location="Any | Client | Downstream | Server | None"
VaryByControl="control"
VaryByCustom="browser |customstring"
VaryByHeader="headers"
VaryByParam="parameter" %>

To store the output cache for a specified duration

Declarative Approach:

<%@ OutputCache Duration="60" VaryByParam="None" %>

Programmatic Approach:

Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);

• To store the output cache on the browser client where the request originated

Declarative Approach:

<%@ OutputCache Duration="60" Location="Client" VaryByParam="None" %>

Programmatic Approach:

Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Private);

• To store the output cache on any HTTP 1.1 cache-capable devices including the proxy servers
and the client that made request

Declarative Approach:

<%@ OutputCache Duration="60" Location="Downstream" VaryByParam="None" %>

Programmatic Approach:
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetNoServerCaching();

• To store the output cache on the Web server

Declarative Approach:

<%@ OutputCache Duration="60" Location="Server" VaryByParam="None" %>

Programmatic Approach:

TimeSpan freshness = new TimeSpan(0,0,0,60);
DateTime now = DateTime.Now;
Response.Cache.SetExpires(now.Add(freshness));
Response.Cache.SetMaxAge(freshness);
Response.Cache.SetCacheability(HttpCacheability.Server);
Response.Cache.SetValidUntilExpires(true);

• To cache the output for each HTTP request that arrives with a different City:

Declarative Approach:

<%@ OutputCache duration="60" varybyparam="City" %>

Programmatic Approach:

Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.VaryByParams["City"] = true;

For the VaryByCustom attribute, the VaryByHeader attribute, and the VaryByParam attribute in the @
OutputCache directive, the HttpCachePolicy class provides the VaryByHeaders property and the
VaryByParams
property, and the SetVaryByCustom method.

1. Page Output Caching

In Page Output Caching, the entire page is cached in memory so all the subsequent requests for the same
page are addressed from the cache itself.

Partial-Page Output Caching/ Page Fragment Caching

In Page Fragment Caching, a specific a portion of the page is cached and not the entire page. Page Output or
Fragment Caching can be enabled or disabled at the Page, Application or even the Machine levels.

More often than not, it is impractical to cache entire pages. For example, you may have some content on
your page that is fairly static, such as a listing of current inventory, but you may have other information,
such as the user's shopping cart, or the current stock price of the company, that you wish to not be cached
at all. Since Output Caching caches the HTML of the entire ASP.NET Web page, clearly Output Caching
cannot be used for these scenarios: enter Partial-Page Output Caching.

Partial-Page Output Caching, or page fragment caching, allows specific regions of pages to be cached.

fragment caching comes from the attribute "VaryByControl". Using this attribute one can cache a user
control based on the properties exposed.

Syntax: <%@ OutputCache Duration="60" VaryByControl="DepartmentId" %>

The above syntax when declared within an *.ascx file ensures that the control is cached for 60 seconds and
the number of representations of cached control is dependant on the property "DepartmentId" declared in
the control.
Data Caching

Programmatic or data caching takes advantage of the .NET Runtime cache engine to store any data or object
between responses. That is, you can store objects into a cache, similar to the storing of objects in
Application scope in classic ASP.

Realize that this data cache is kept in memory and "lives" as long as the host application does. In other
words, when the ASP.NET application using data caching is restarted, the cache is destroyed and recreated.
Data Caching is almost as easy to use as Output Caching or Fragment caching: you simply interact with it as
you would any simple dictionary object.

Note that the Insert method allows you to simply add items to the cache using a key and value notation as
well. For example to simply add an instance of the object bar to the cache named foo, use syntax like this:

Cache.Insert("foo", bar); // C#
Cache.Insert("foo", bar) ' VB.NET

Question - Define Caching in ASP.NET.
Answer - Caching technique allows to store/cache page output or application data on the client. The cached
information is used to serve subsequent requests that avoid the overhead of recreating the same
information. This enhances performance when same information is requested many times by the user.


Question - Advantages of Caching
Answer - It increases performance of the application by serving user with cached output.
It decreases server round trips for fetching data from database by persisting data in the memory.
It greatly reduces overhead from server resources.

Question - What are the types of Caching in ASP.NET?
Answer - Caching in ASP.NET can be of the following types
Page Output Caching
Page Fragment Caching
Data Caching

Question - Explain in brief each kind of caching in ASP.NET.
Answer - Page Output Caching
This type of caching is implemented by placing OutputCache directive at the top of the .aspx page at design
time.
For example:
<%@OutputCache Duration= "30" VaryByParam= "DepartmentId"%>

The duration parameter specifies for how long the page would be in cache and the VaryByParam parameter
is used to cache different version of the page.
The VaryByParam parameter is useful when we require caching a page based on certain criteria.

Page Fragment Caching
This technique is used to store part of a Web form response in memory by caching a user control.

Data Caching
Data Caching is implemented by using Cache object to store and quick retrieval of application data.
Cache object is just like application object which can be access anywhere in the application.
The lifetime of the cache is equivalent to the lifetime of the application.

Question:-What do you mean by Share Point Portal ?
Answer: Here I have taken information regarding Share Point Portal Server 2003 provides mainly access to
the crucial business information and applications. With the help of Share Point Server we can server
information between Public Folders, Data Bases, File Servers and the websites that are based on Windows
server 2003. This Share Point Portal is integrated with MSAccess and Windows servers, So we can get a
Wide range of document management functionality. We can also create a full featured portal with
readymade navigation and structure.
Question:-What is cross page posting in ASP.NET2.0 ?
Answer: When we have to post data from one page to another in application we used server.transfer
method but in this the URL remains the same but in cross page posting there is little different there is
normal post back is done but in target page we can access values of server control in the source page.This is
quite simple we have to only set the PostBackUrl property of Button,LinkButton or imagebutton which
specifies the target page. In target page we can access the PreviousPage property. and we have to use the
@PreviousPageType directive. We can access control of PreviousPage by using the findcontrol method. When
we set the PostBackURL property ASP.NET framework bind the HTML and Javascript function automatically.

Question: How to start Outlook,NotePad file in AsP.NET with code ?
Answer: Here is the syntax to open outlook or notepad file in ASP.NET VB.NET
Process.Start("Notepad.exe") Process.Start("msimn.exe"); C#.NET
System.Diagnostics.Process.Start("msimn.exe"); System.Diagnostics.Process.Start("Notepad.exe");

Question: What is the purpose of IIS ?
Answer: We can call IIS(Internet Information Services) a powerful Web server that helps us creating highly
reliable, scalable and manageable infrastructure for Web application which runs on Windows Server 2003.
IIS helps development center and increase Web site and application availability while lowering system
administration costs. It also runs on Windows NT/2000 platforms and also for above versions. With IIS,
Microsoft includes a set of programs for building and administering Web sites, a search engine, and support
for writing Web-based applications that access database. IIS also called http server since it process the http
request and gets http response.

Question: What is main difference between GridLayout and FormLayout ?
Answer: GridLayout helps in providing absolute positioning of every control placed on the page. It is easier
to develop page with absolute positioning because control can be placed any where according to our
requirement. But FormLayout is little different only experience Web Developer used this one reason is it is
helpful for wider range browser. If there is absolute positioning we can notice that there are number of DIV
tags. But in FormLayout whole work are done through the tables.

Question: How Visual SourceSafe helps Us ?
Answer: One of the powerful tool provided by Microsoft to keep up-to-date of files system its keeps records
of file history once we add files to source safe it can be add to database and the changes ads by different
user to this files are maintained in database from that we can get the older version of files to. This also helps
in sharing,merging of files.

Question:-Can you define what is SharePoint and some overview about this ?
Answer: SharePoint helps workers for creating powerful personalized interfaces only by dragging and drop
pre-defined Web Part Components. And these Web Parts components also helps non programmers to get
information which care and customize the appearance of Web pages. To under stand it we take an example
 one Web Part might display a user's information another might create a graph showing current employee
status and a third might show a list of Employees Salary. This is also possible that each functions has a link
to a video or audio presentation. So now Developers are unable to create these Web Part components and
make them available to SharePoint users.

Question:-What is different between WebUserControl and in WebCustomControl ?
Answer: Web user controls :- Web User Control is Easier to create and another thing is that its support is
limited for users who use a visual design tool one good thing is that its contains static layout one more thing
a separate copy is required for each application.
Web custom controls:-Web Custom Control is typical to create and good for dynamic layout and another
thing is it have full tool support for user and a single copy of control is required because it is placed in Global
Assembly cache.

Question:-What is Sandbox in SQL server and explain permission level in Sql Server ?
Answer: Sandbox is place where we run trused program or script which is created from the third party.
There are three type of Sandbox where user code run.
Safe Access Sandbox:-Here we can only create stored procedure,triggers,functions,datatypes etc.But we
doesnot have acess memory ,disk etc.
External Access Sandbox:-We cn access File systems outside the box. We can not play with
threading,memory allocation etc.
Unsafe Access Sandbox:-Here we can write unreliable and unsafe code.
Question:-How many types of cookies are there in .NET ?
Answer: Two type of cookeies.
a) single valued eg request.cookies(”UserName”).value=”dotnetquestion”
b)Multivalued cookies. These are used in the way collections are used example
request.cookies(”CookiName”)(”UserName”)=”dotnetquestionMahesh”
request.cookies(”CookiName”)(”UserID”)=”interview″

Question: When we get Error 'HTTP 502 Proxy Error' ?
Answer: We get this error when we execute ASP.NET Web pages in Visual Web Developer Web server,
because the URL randomly select port number and proxy servers did not recognize the URL and return this
error. To resolve this problem we have to change settings in Internet Explorer to bypass the proxy server for
local addresses, so that the request is not sent to the proxy.

Question:-What do you mean by three-tier architecture?
Answer: The three-tier architecture was comes into existence to improve management of code and contents
and to improve the performance of the web based applications. There are mainly three layers in three-tier
architecture. the are define as follows
(1)Presentation
(2)Business Logic
(3)Database

(1)First layer Presentation contains mainly the interface code, and this is shown to user. This code could
contain any technology that can be used on the client side like HTML, JavaScript or VBScript etc.

(2)Second layer is Business Logic which contains all the code of the server-side .This layer have code to
interact with database and to query, manipulate, pass data to user interface and handle any input from the
UI as well.

(3)Third layer Data represents the data store like MS Access, SQL Server, an XML file, an Excel file or even
a text file containing data also some additional database are also added to that layers.

Question: What is Finalizer in .NET define Dispose and Finalize?
Answer: We can say that Finalizer are the methods that's helps in cleanp the code that is executed before
object is garbage collected .The process is called finalization . There are two methods of finalizer Dispose
and Finalize .There is little diffrenet between two of this method .
When we call Dispose method is realse all the resources hold by an object as well as all the resorces hold by
the parent object.When we call Dispose method it clean managed as well as unmanaged resources.
Finalize methd also cleans resources but finalize call dispose clears only the unmanged resources because in
finalization the garbase collecter clears all the object hold by managed code so finalization fails to prevent
thos one of methd is used that is: GC.SuppressFinalize.

Question: What is late binding ?
Answer: When code interacts with an object dynamically at runtime .because our code literally doesnot care
what type of object it is interacting and with the methods thats are supported by object and with the
methods thats are supported by object .The type of object is not known by the IDE or compiler ,no
Intellisense nor compile-time syntax checking is possible but we get unprecedented flexibilty in exchange.if
we enable strict type checking by using option strict on at the top of our code modules ,then IDE and
compiler will enforce early binding behaviour .By default Late binding is done.

Question:-Does .NET CLR and SQL SERVER run in different process?
Answer: Dot Net CLR and all .net realtes application and Sql Server run in same process or we can say that
that on the same address because there is no issue of speed because if these two process are run in
different process then there may be a speed issue created one process goes fast and other slow may create
the problem.

Question: The IHttpHandler and IHttpHandlerFactory interfaces ?
Answer: The IHttpHandler interface is implemented by all the handlers. The interface consists of one
property called IsReusable. The IsReusable property gets a value indicating whether another request can use
the IHttpHandler instance. The method ProcessRequest() allows you to process the current request. This is
the core place where all your code goes. This method receives a parameter of type HttpContext using which
you can access the intrinsic objects such as Request and Response. The IHttpHandlerFactory interface
consists of two methods - GetHandler and ReleaseHandler. The GetHandler() method instantiates the
required HTTP handler based on some condition and returns it back to ASP.NET. The ReleaseHandler()
method allows the factory to reuse an existing handler.

Question: what is Viewstate?
Answer:View state is used by the ASP.NET page framework to automatically save the values of the page
and of each control just prior to rendering to the page. When the page is posted, one of the first tasks
performed by page processing is to restore view state.
State management is the process by which you maintain state and page information over multiple requests
for the same or different pages.

Client-side options are:

* The ViewState property         * Query strings           * Hidden fields           * Cookies

Server-side options are:

* Application state              * Session state                   * DataBase

Use the View State property to save data in a hidden field on a page. Because ViewState stores data on the
page, it is limited to items that can be serialized. If you want to store more complex items in View State, you
must convert the items to and from a string.
ASP.NET provides the following ways to retain variables between requests:
Context.Handler object Use this object to retrieve public members of one Web form’s class from a
subsequently displayed Web form.
Query strings Use these strings to pass information between requests and responses as part of the Web
address. Query strings are visible to the user, so they should not contain secure information such as
passwords.
Cookies Use cookies to store small amounts of information on a client. Clients might refuse cookies, so your
code has to anticipate that possibility.
View state ASP.NET stores items added to a page’s ViewState property as hidden fields on the page.
Session state Use Session state variables to store items that you want keep local to the current session
(single user).
Application state Use Application state variables to store items that you want be available to all users of
the application.

Describe the security authentication flow and process in ASP.NET?

When a user requests a web page, there exists a process of security too, so that every anonymous user is
checked for authentication before gaining access to the webpage. The following points are followed in the
sequence for authentication when a client attempts a page request:

    •   A .aspx web page residing on an IIS web server is requested by an end user
    •   IIS checks for the user's credentials
    •   Authentication is done by IIS. If authenticated, a token is passed to the ASP.NET worker process
        along with the request
    •   Based on the authentication token from IIS, and on the web.config settings for the requested
        resource, ASP.NET impersonates the end user to the request thread. For impersonation, the
        web.config impersonate attribute's value is checked.

What is Authentication? What are the different types of Authentication?

In a client-server environment, there are plenty of cases where the server has to interact and identify the
client that sends a request to the server. Authentication is the process of determining and confirming the
identity of the client.

If a client is not successfully identified, it is said to be anonymous.

Windows Authentication           Forms Authentication      Passport Authentication

Essentially the Windows Authentication and Forms Authentication are the famous ones, as Passport
Authentication is related to a few websites (like microsoft.com, hotmail.com, msn.com etc. only).
Windows Authentication is implemented mostly in Intranet scenarios. When a browser (client) sends a
Request to a server where in windows authentication has been implemented, the initial request is
anonymous in nature. The server sends back a Response with a message in HTTP Header. This Prompts a
Window to display a Modal Dialog Box on the browser, where the end user may enter the "User name" and
"Password".

The end user enters the credentials, which are then validated against the User Store on the Windows server.
Note that each user who access the Web Application in a Windows Authentication environment needs to have
a Windows Account in the company network.

How to avoid or disable the modal dialog box in a Windows Authentication environment?
By enabling the Windows Integrated Authentication checkbox for the web application through settings in IIS.

Forms Authentication is used in Internet based scenarios, where its not practical to provide a Windows based
account to each and every user to the Web Server. In a Forms Authentication environment, the user enters
credentials, usually a User Name and a corresponding Password, which is validated against a User
Information Store, ideally a database table.

Forms Authentication Ticket is the cookie stored on the user's computer, when a user is authenticated. This
helps in automatically logging in a user when he/she re-visits the website. When a Forms Authentication
ticket is created, when a user re-visits a website, the Forms Authentication Ticket information is sent to the
Web Server along with the HTTP Request.

Describe the Provider Model in ASP.NET 2.0?

The Provider model in ASP.NET 2.0 is based on the Provider Design Pattern that was created in the year
2002 and later implemented in the .NET Framework 2.0.

The Provider Model supports automatic creation of users and their respective roles by creating entries of
them directly in the SQL Server (May even use MS Access and other custom data sources). So actually, this
model also supports automatically creating the user table's schema.

The Provider model has 2 security providers in it: Membership provider and Role Provider. The membership
provider saves inside it the user name (id) and corresponding passwords, whereas the Role provider stores
the Roles of the users.

For SQL Server, the SqlMembershipProvider is used, while for MS Access, the AccessMembershipProvider is
used. The Security settings may be set using the website adminstration tool. Automatically, the
AccessMembershipProvider creates a Microsoft Access database file named aspnetdb.mdb inside the
application's App_Data folder. This contains 10 tables.

Describe the Personalization in ASP.NET 2.0?

ASP.NET 2.0 Personalization - Personalization allows information about visitors to be persisted on a data
store so that the information can be useful to the visitor when they visit the site again. In ASP.NET 2.0, this
is controlled by a Personalization API. Before the Personalization Model came into existence, the prior
versions of ASP.NET used of the old Session object to take care of re-visits. Now comes the Profile object.

In order to use a Profile object, some settings need to be done in web.config. The example below shall
explain how to use a profile object:

//Add this to System.Web in web.config

<profile>
<properties>
 <add name="FirstName" type="System.String"/>
</properties>
</profile>

'In Page_Load event, add the following...

If Profile.FirstName <> "" Then
Panel1.Visible = False
  Response.Write("Welcome Back Dear :, " & Profile.FirstName & ", " & Profile.LastName)
Else
  Panel1.Visible = True
End If

'Here is the code how to save the profile properties in an event to save it
Profile.FirstName = txtFirstName.Text

Explain about Generics?

Generics are not a completely new construct; similar concepts exist with other languages. For example, C++
templates can be compared to generics. However, there's a big difference between C++ templates and .NET
generics. With C++ templates the source code of the template is required when a template is instantiated
with a specific type. Contrary to C++ templates, generics are not only a construct of the C# language;
generics are defined with the CLR. This makes it possible to instantiate generics with a specific type in Visual
Basic even though the generic class was defined with C#.

Why we use Serialization?

Serialization of data using built-in .NET support makes persistence easy and reusable.

Most uses of serialization fall into two categories: persistence and data interchange. Persistence allows
us to store the information on some non-volatile mechanism for future use. This includes multiple uses of
our application, archiving, and so on. Data interchange is a bit more versatile in its uses. If our application
takes the form of an N-tier solution, it will need to transfer information from client to server, likely using a
network protocol such as TCP. To achieve this we would serialize the data structure into a series of bytes
that we can transfer over the network. Another use of serialization for data interchange is the use of XML
serialization to allow our application to share data with another application altogether. As you can see,
serialization is a part of many different solutions within our application.

What is Serialization?

Serialization is the process of converting an object, or group of objects, into a form that can be persisted.
When u serialize an object, you also serialize the values of its properties.

How Do You Use Serialization?

Serialization is handled primarily by classes and interfaces in the System.Runtime.Serialization
namespace. To serialize an object, you need to create two things:

    •   A stream to contain the serialized objects.
    •   A formatter to serialize the objects into the stream.

The Role of Formatters in .NET Serialization

A formatter is used to determine the serialized format for objects. All formatters expose the IFormatter
interface, and two formatters are provided as part of the .NET framework:

    •   BinaryFormatter provides binary encoding for compact serialization to storage, or for socket-based
        network streams. The BinaryFormatter class is generally not appropriate when data must be passed
        through a firewall.
    •   SoapFormatter provides formatting that can be used to enable objects to be serialized using the
        SOAP protocol. The SoapFormatter class is primarily used for serialization through firewalls or among
        diverse systems. The .NET framework also includes the abstract Formatter class that may be used as
        a base class for custom formatters. This class inherits from the IFormatter interface, and all
        IFormatter properties and methods are kept abstract, but you do get the benefit of a number of
        helper methods that are provided for you.

Weitere ähnliche Inhalte

Was ist angesagt?

RSA and RC4 Cryptosystem Performance Evaluation Using Image and Text
RSA and RC4 Cryptosystem Performance Evaluation Using Image and TextRSA and RC4 Cryptosystem Performance Evaluation Using Image and Text
RSA and RC4 Cryptosystem Performance Evaluation Using Image and TextYekini Nureni
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityShubham Narkhede
 
Security analysis of fbdk block cipher for digital images
Security analysis of fbdk block cipher for digital imagesSecurity analysis of fbdk block cipher for digital images
Security analysis of fbdk block cipher for digital imageseSAT Journals
 
IRJET- Data Transmission using RSA Algorithm
IRJET-  	  Data Transmission using RSA AlgorithmIRJET-  	  Data Transmission using RSA Algorithm
IRJET- Data Transmission using RSA AlgorithmIRJET Journal
 
IRJET- Comparison Among RSA, AES and DES
IRJET-  	  Comparison Among RSA, AES and DESIRJET-  	  Comparison Among RSA, AES and DES
IRJET- Comparison Among RSA, AES and DESIRJET Journal
 
New Web 2.0 Attacks, B.Sc. Thesis
New Web 2.0 Attacks, B.Sc. ThesisNew Web 2.0 Attacks, B.Sc. Thesis
New Web 2.0 Attacks, B.Sc. ThesisKrassen Deltchev
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan GoleChetan Gole
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design patternMindfire Solutions
 
Very short OOP Introduction
Very short OOP IntroductionVery short OOP Introduction
Very short OOP IntroductionCristian G
 
Ieeepro techno solutions 2014 ieee java project -key-aggregate cryptosystem...
Ieeepro techno solutions   2014 ieee java project -key-aggregate cryptosystem...Ieeepro techno solutions   2014 ieee java project -key-aggregate cryptosystem...
Ieeepro techno solutions 2014 ieee java project -key-aggregate cryptosystem...hemanthbbc
 
Comparative study of private and public key cryptography algorithms a survey
Comparative study of private and public key cryptography algorithms a surveyComparative study of private and public key cryptography algorithms a survey
Comparative study of private and public key cryptography algorithms a surveyeSAT Publishing House
 
IRJET- Comparative Analysis of Encryption Techniques
IRJET-  	  Comparative Analysis of Encryption TechniquesIRJET-  	  Comparative Analysis of Encryption Techniques
IRJET- Comparative Analysis of Encryption TechniquesIRJET Journal
 

Was ist angesagt? (20)

Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
RSA and RC4 Cryptosystem Performance Evaluation Using Image and Text
RSA and RC4 Cryptosystem Performance Evaluation Using Image and TextRSA and RC4 Cryptosystem Performance Evaluation Using Image and Text
RSA and RC4 Cryptosystem Performance Evaluation Using Image and Text
 
50120140507006
5012014050700650120140507006
50120140507006
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
 
Security analysis of fbdk block cipher for digital images
Security analysis of fbdk block cipher for digital imagesSecurity analysis of fbdk block cipher for digital images
Security analysis of fbdk block cipher for digital images
 
IRJET- Data Transmission using RSA Algorithm
IRJET-  	  Data Transmission using RSA AlgorithmIRJET-  	  Data Transmission using RSA Algorithm
IRJET- Data Transmission using RSA Algorithm
 
Design patterns
Design patternsDesign patterns
Design patterns
 
IRJET- Comparison Among RSA, AES and DES
IRJET-  	  Comparison Among RSA, AES and DESIRJET-  	  Comparison Among RSA, AES and DES
IRJET- Comparison Among RSA, AES and DES
 
New Web 2.0 Attacks, B.Sc. Thesis
New Web 2.0 Attacks, B.Sc. ThesisNew Web 2.0 Attacks, B.Sc. Thesis
New Web 2.0 Attacks, B.Sc. Thesis
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
 
Design pattern
Design patternDesign pattern
Design pattern
 
Ijnsa050213
Ijnsa050213Ijnsa050213
Ijnsa050213
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
 
Very short OOP Introduction
Very short OOP IntroductionVery short OOP Introduction
Very short OOP Introduction
 
Ieeepro techno solutions 2014 ieee java project -key-aggregate cryptosystem...
Ieeepro techno solutions   2014 ieee java project -key-aggregate cryptosystem...Ieeepro techno solutions   2014 ieee java project -key-aggregate cryptosystem...
Ieeepro techno solutions 2014 ieee java project -key-aggregate cryptosystem...
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Cryptographic lifecycle security training
Cryptographic lifecycle security trainingCryptographic lifecycle security training
Cryptographic lifecycle security training
 
Comparative study of private and public key cryptography algorithms a survey
Comparative study of private and public key cryptography algorithms a surveyComparative study of private and public key cryptography algorithms a survey
Comparative study of private and public key cryptography algorithms a survey
 
IRJET- Comparative Analysis of Encryption Techniques
IRJET-  	  Comparative Analysis of Encryption TechniquesIRJET-  	  Comparative Analysis of Encryption Techniques
IRJET- Comparative Analysis of Encryption Techniques
 

Andere mochten auch

Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questionsJayesh Kheradia
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1ReKruiTIn.com
 
Top 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answersTop 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answerssonia merchant
 
Dot net interview questions
Dot net interview questionsDot net interview questions
Dot net interview questionsNetra Wable
 
Dot Net Accenture
Dot Net AccentureDot Net Accenture
Dot Net AccentureSri K
 
Railway reservation system
Railway reservation systemRailway reservation system
Railway reservation systemAbhishek Yadav
 
PAPER PRESENTATION
PAPER PRESENTATIONPAPER PRESENTATION
PAPER PRESENTATIONZeba Tamana
 
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
ASP.NET MVC Interview Questions and Answers by Shailendra ChauhanASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
ASP.NET MVC Interview Questions and Answers by Shailendra ChauhanShailendra Chauhan
 
E-TICKETING ON RAILWAY TICKET RESERVATION
E-TICKETING ON RAILWAY TICKET RESERVATIONE-TICKETING ON RAILWAY TICKET RESERVATION
E-TICKETING ON RAILWAY TICKET RESERVATIONNandana Priyanka Eluri
 
important DotNet Questions For Practicals And Interviews
important DotNet Questions For Practicals And Interviewsimportant DotNet Questions For Practicals And Interviews
important DotNet Questions For Practicals And InterviewsRahul Jain
 
Railway reservation management by sandip murari
Railway reservation management by sandip murariRailway reservation management by sandip murari
Railway reservation management by sandip murariSandip Murari
 
16103271 software-testing-ppt
16103271 software-testing-ppt16103271 software-testing-ppt
16103271 software-testing-pptatish90
 
Synopsis for Online Railway Railway Reservation System
Synopsis for Online Railway Railway Reservation SystemSynopsis for Online Railway Railway Reservation System
Synopsis for Online Railway Railway Reservation SystemZainabNoorGul
 

Andere mochten auch (20)

Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1
 
resume
resumeresume
resume
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 
Types of instrument
Types of instrumentTypes of instrument
Types of instrument
 
Top 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answersTop 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answers
 
Interview questions on asp
Interview questions on aspInterview questions on asp
Interview questions on asp
 
Dot net interview questions
Dot net interview questionsDot net interview questions
Dot net interview questions
 
Dot Net Accenture
Dot Net AccentureDot Net Accenture
Dot Net Accenture
 
Railway reservation system
Railway reservation systemRailway reservation system
Railway reservation system
 
PAPER PRESENTATION
PAPER PRESENTATIONPAPER PRESENTATION
PAPER PRESENTATION
 
HTML & XHTML Basics
HTML & XHTML BasicsHTML & XHTML Basics
HTML & XHTML Basics
 
Online railway reservation system
Online railway reservation systemOnline railway reservation system
Online railway reservation system
 
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
ASP.NET MVC Interview Questions and Answers by Shailendra ChauhanASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
 
E-TICKETING ON RAILWAY TICKET RESERVATION
E-TICKETING ON RAILWAY TICKET RESERVATIONE-TICKETING ON RAILWAY TICKET RESERVATION
E-TICKETING ON RAILWAY TICKET RESERVATION
 
important DotNet Questions For Practicals And Interviews
important DotNet Questions For Practicals And Interviewsimportant DotNet Questions For Practicals And Interviews
important DotNet Questions For Practicals And Interviews
 
Railway reservation management by sandip murari
Railway reservation management by sandip murariRailway reservation management by sandip murari
Railway reservation management by sandip murari
 
Online Railway reservation
Online Railway reservationOnline Railway reservation
Online Railway reservation
 
16103271 software-testing-ppt
16103271 software-testing-ppt16103271 software-testing-ppt
16103271 software-testing-ppt
 
Synopsis for Online Railway Railway Reservation System
Synopsis for Online Railway Railway Reservation SystemSynopsis for Online Railway Railway Reservation System
Synopsis for Online Railway Railway Reservation System
 

Ähnlich wie 7 latest-dot-net-interview-questions

136 latest dot net interview questions
136  latest dot net interview questions136  latest dot net interview questions
136 latest dot net interview questionssandi4204
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxArifaMehreen1
 
ActionScript Design Patterns
ActionScript Design Patterns ActionScript Design Patterns
ActionScript Design Patterns Yoss Cohen
 
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design PatternsNina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design Patternsiasaglobal
 
Bartlesville Dot Net User Group Design Patterns
Bartlesville Dot Net User Group Design PatternsBartlesville Dot Net User Group Design Patterns
Bartlesville Dot Net User Group Design PatternsJason Townsend, MBA
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Luis Valencia
 
Best practices in enterprise applications
Best practices in enterprise applicationsBest practices in enterprise applications
Best practices in enterprise applicationsChandra Sekhar Saripaka
 
Top 30 Technical interview questions
Top 30 Technical interview questionsTop 30 Technical interview questions
Top 30 Technical interview questionsSohailSaifi15
 
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...Anil Sharma
 
In responding to your peers’ posts, assess your peers’ recommendatio.docx
In responding to your peers’ posts, assess your peers’ recommendatio.docxIn responding to your peers’ posts, assess your peers’ recommendatio.docx
In responding to your peers’ posts, assess your peers’ recommendatio.docxmecklenburgstrelitzh
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingPatricia Viljoen
 
New enterprise application and data security challenges and solutions apr 2...
New enterprise application and data security challenges and solutions   apr 2...New enterprise application and data security challenges and solutions   apr 2...
New enterprise application and data security challenges and solutions apr 2...Ulf Mattsson
 
.NET TECHNOLOGIES
.NET TECHNOLOGIES.NET TECHNOLOGIES
.NET TECHNOLOGIESProf Ansari
 
Design Pattern with Actionscript
Design Pattern with ActionscriptDesign Pattern with Actionscript
Design Pattern with ActionscriptDaniel Swid
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patternssukumarraju6
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in androidJay Kumarr
 

Ähnlich wie 7 latest-dot-net-interview-questions (20)

136 latest dot net interview questions
136  latest dot net interview questions136  latest dot net interview questions
136 latest dot net interview questions
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptx
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
ActionScript Design Patterns
ActionScript Design Patterns ActionScript Design Patterns
ActionScript Design Patterns
 
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design PatternsNina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
 
Bartlesville Dot Net User Group Design Patterns
Bartlesville Dot Net User Group Design PatternsBartlesville Dot Net User Group Design Patterns
Bartlesville Dot Net User Group Design Patterns
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
Hibernate3 q&a
Hibernate3 q&aHibernate3 q&a
Hibernate3 q&a
 
Best practices in enterprise applications
Best practices in enterprise applicationsBest practices in enterprise applications
Best practices in enterprise applications
 
Top 30 Technical interview questions
Top 30 Technical interview questionsTop 30 Technical interview questions
Top 30 Technical interview questions
 
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
 
In responding to your peers’ posts, assess your peers’ recommendatio.docx
In responding to your peers’ posts, assess your peers’ recommendatio.docxIn responding to your peers’ posts, assess your peers’ recommendatio.docx
In responding to your peers’ posts, assess your peers’ recommendatio.docx
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
New enterprise application and data security challenges and solutions apr 2...
New enterprise application and data security challenges and solutions   apr 2...New enterprise application and data security challenges and solutions   apr 2...
New enterprise application and data security challenges and solutions apr 2...
 
.NET TECHNOLOGIES
.NET TECHNOLOGIES.NET TECHNOLOGIES
.NET TECHNOLOGIES
 
Design Pattern with Actionscript
Design Pattern with ActionscriptDesign Pattern with Actionscript
Design Pattern with Actionscript
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
 

7 latest-dot-net-interview-questions

  • 1. LATEST DOT NET INTERVIEW QUESTIONS What are Design Patterns? A Design Pattern essentially consists of a problem in a software design and a solution to the same. In Design Patterns each pattern is described with its name, the motivation behind the pattern and its applicability. According to MSDN, "A design pattern is a description of a set of interacting classes that provide a framework for a solution to a generalized problem in a specific context or environment. In other words, a pattern suggests a solution to a particular problem or issue in object-oriented software development. Benefits of Design Patterns The following are some of the major advantages of using Design Patterns in software development. · Flexibility · Adaptability to change · Reusability When to use Design Patterns Design Patterns are particularly useful in one of the following scenarios. · When the software application would change in due course of time. · When the application contains source code that involves object creation and event notification. When not to use Design Patterns . Do not use design patterns in any of the following situations. · When the software being designed would not change with time. · When the requirements of the source code of the application are unique. If any of the above applies in the current software design, there is no need to apply design patterns in the current design and increase unnecessary complexity in the design. The Gang of Four (GOF) Patterns The invention of the design patterns that we commonly use today can be attributed to the following four persons: Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. These men invented 23 patterns in all that are commonly known as the Gang of Four patterns or the GOF patterns. · Creational · Structural · Behavioral Each of these groups in turn contains related sub patterns. Creational Patterns The Creational Patterns deals with the best possible way of creating an object or an instance of a class. They simplify object creation and provide a flexible approach towards object creation. The following are the sub-patterns that fall under this group. · Abstract Factory · Factory · Builder · Prototype · Singleton Both the Abstract Factory and the Factory pattern have the same intent.
  • 2. The Singleton Pattern indicates that there can be only one instance of a class throughout the Application’s life cycle. A singleton class is one that can be instantiated only once in the application domain and provides a global point of access to it. Structural Patterns Structural Patterns provides the flexibility to specify how objects and classes can interoperate. The following are the sub patterns that comprise the Structural Patterns group. · Adapter · Façade · Bridge · Composite · Decorator · Flyweight · Proxy · Adapter · Bridge · Composite · Decorator · Flyweight · Proxy Behavioral Patterns Behavioral patterns help you define a structure for inter-object communication between objects in your system. This design pattern is typically used to monitor the messages that are transmitted when the objects communicate in a system. The following are the sub patterns under Behavioral Patterns. · Chain of Responsibility · Command · Interpreter · Iterator · Mediator · Memento · Observer · State · Strategy · Template Method · Visitor ASP.NET MVC is a framework that allows developers to apply the MVC pattern in the development of an ASP.NET application, thus allowing a better separation of concerns, which results in better reusability and easier testing. MVC consists of three kinds of objects The Model is an application object. The View is the screen presentation. The controller defines the way the user interface reacts to user inputs • The request comes from the client and hits the Controller. • The Controller calls the Model in order to perform some "business" operations. • The Model returns the results of the operations back to the Controller. • The Controller decides which View needs to be rendered and sends it the data that must be rendered. • Finally the View renders the output and sends the response back to the client. What is Cryptography? Cryptography is used to protect data and has many valuable uses. It can protect data from being viewed, modified, or to ensure the integrity from the originator. Cryptography can be used as a mechanism to provide secure communication over an unsecured network, such as the Internet, by encrypting data, sending it across the network in the encrypted state, and then the decrypting the data on the receiving end. Encryption can also be used as an additional security mechanism to further protect data such as passwords stored in a database to prevent them from being human readable or understandable. Encryption Components
  • 3. Encryption involves the use of a cryptography algorithm combined with a key to encrypt and decrypt the data. The goal of every encryption algorithm is to make it as difficult as possible to decrypt the data without the proper key. Data is translated from its originating form into something that appears meaningless unless the proper algorithm and key are used to decrypt the data. The Microsoft .NET Framework classes (System.Security.Cryptography) will manage the details of cryptography for you. The classes are implemented with the same interface; so working with the classes is the same across the cryptography namespace. Public-Key Encryption Public-key encryption, also known as asymmetric encryption, uses a public and private key pair to encrypt and decrypt data. The public key is made available to anyone and is used to encrypt data to be sent to the owner of the private key. The private key, as the name implies, is kept private. The private key is used to decrypt the data and will only work if the correct public key was used when encrypting the data. The private key is the only key that will allow data encrypted with the public key to be decrypted. The keys can be stored for use multiple times, or generated for a one-time use. Asymmetric encryption algorithms are usually efficient for encrypting small amounts of data only. The following public-key algorithms are available for use in the .NET Framework. Digital Signature Algorithm (DSA) RSA Private-Key Encryption Private-key Encryption, also known as symmetric encryption, uses a single key to encrypt and decrypt information. The key must be kept secret from those not authorized to decrypt the data lest the data be compromised. Private-key algorithms are relatively fast and can be used to encrypt and decrypt large streams of data. Private-key algorithms are known as block ciphers because they encrypt data one block at a time. A block cipher will encrypt the same input block into the same output block based on the algorithm and key. If the anything were known about the structure of the data, patterns could be detected and the key could possibly be reverse engineered. To combat this, the classes in the .NET Framework use a process known as chaining where information from the previous block is used in encrypting the current block. This helps prevent the key from being discovered. It requires an initialization vector (IV) be given to encrypt the first block of data. The following private-key algorithms are available in the .NET Framework. Each description contains some basic information about each algorithm, including the strengths and weaknesses. Data Encryption Standard (DES) algorithm encrypts and decrypts data in 64-bit blocks, using a 64-bit key. Even though the key is 64-bit, the effective key strength is only 56-bits. There are hardware devices advanced enough that they can search all possible DES keys in a reasonable amount of time. This makes the DES algorithm breakable, and the algorithm is considered somewhat obsolete. RC2 is a variable key-size block cipher. The key size can vary from 8-bit up to 64-bits for the key. It was specifically designed as a more secure replacement to DES. The processing speed is two to three times faster than DES. However, the RC2CryptoServiceProvider available in the .NET Framework is limited to 8 characters, or a 64-bit key. The 8-character limitation makes it susceptible to the same brute force attack as DES. TripleDES algorithm uses three successive iterations of the DES algorithm. The algorithm uses either two or three keys. Just as the DES algorithm, the key size is 64-bit per key with an effective key strength of 56-bit per key. The TripleDES algorithm was designed to fix the shortcomings of the DES algorithm, but the three iterations result in a processing speed three times slower than DES alone. Rijndael algorithm, one of the Advanced Encryption Standard (AES) algorithms, was designed as a replacement for the DES algorithms. The key strength is stronger than DES, and was designed to out
  • 4. perform DES. The key can vary in length from 128, 192, to 256 bits in length. This is the algorithm I personally trust the most and that I'll use for the examples contained in the column. Hashing Algorithms No, I'm not talking about some type of drug related activity or an extra special recipe for brownies. Hashing refers to mapping data of any length into a fixed-length byte sequence. Regardless of if the input is the contents of the library of Congress or the typing test "The quick brown fox jumps over the lazy dog" it will result in an output of the same size. Hashing also produces unique results. Just as no two snowflakes are identical, no two combinations of input will produce the same hash output. Even if the input varies by a single character it will produce different output. The .NET Framework provides support for the following hash algorithms of which I'll leave it up to you to discover which one is right for you based on the size of the data you require. HMACSHA1 MACTripleDES MD5CryptoServiceProvider SHA1Managed SHA256Managed SHA384Managed SHA512Managed How to Generate a Key and IV for Private-key Encryption Each algorithm has specific key sizes that it expects for use. Each key must fit a predetermined size typically ranging from 1 character (8-bit) up to 32 characters (256-bit). Some of the algorithms support varying key sizes, but they must be within the valid ranges of key size for the particular algorithm. For our purposes, we'll use Rijndael, which supports 128, 192, and 256 bit keys. The way to generate a 128-bit key for use is through one of the hashing algorithms. A phrase, or "secret" of any length can be hashed to generate a key of the required size for encrypting data. The following code outlines a class containing a method that takes an input phrase and generates a key and IV for use. Using Encryption to Protect Sensitive Data Stored in a Database This brings us to a possible and often overlooked use for encryption, which is encrypting data such as passwords that are stored in a database. There are several benefits to storing sensitive data such as passwords in encrypted format. It keeps sensitive application data such as passwords secret from those authorized to view data that ideally should not be able to see application specific data such as passwords. It keeps passwords protected from unauthorized access. If the database is somehow compromised, the intruder must now the correct algorithm and key to decrypt the sensitive data. Passing direct input to a query is dangerous because you never know what the input may contain. Suppose a stored procedure including something like "WHERE vc_Login = @Login and Password = @Password" is used for authentication. A user name of "'m' or 1=1" with the same for the password could evaluate to a true statement and result in incorrectly allowing access. If the user id and or password were stored encrypted then the data would not evaluate to a valid SQL statement because an encrypted form of the statement would be used in the evaluation. 22 New Features of Visual Studio 2008 for .NET Professionals 1. LINQ Support LINQ essentially is the composition of many standard query operators that allow you to work with data in a more intuitive way regardless. The benefits of using LINQ are significant – Compile time checking C# language queries, and the ability to debug step by step through queries. 2. Expression Blend Support
  • 5. Expression blend is XAML generator tool for silverlight applications. You can install Expression blend as an embedded plug-in to Visual Studio 2008. By this you can get extensive web designer and JavaScript tool. 3. Windows Presentation Foundation WPF provides you an extensive graphic functionality you never seen these before. Visual Studio 2008 contains plenty of WPF Windows Presentation Foundation Library templates. By this a visual developer who is new to .NET, C# and VB.NET can easily develop the 2D and 3D graphic applications. Visual Studio 2008 provides free game development library kits for games developers. currently this game development kits are available for C++ and also 2D/3D Dark Matter one image and sounds sets. 4. VS 2008 Multi-Targeting Support Earlier you were not able to working with .NET 1.1 applications directly in visual studio 2005. Now in Visual studio 2008 you are able to create, run, debug the .NET 2.0, .NET 3.0 and .NET 3.5 applications. You can also deploy .NET 2.0 applications in the machines which contains only .NET 2.0 not .NET 3.x. 5. AJAX support for ASP.NET Previously developer has to install AJAX control library separately that does not come from VS, but now if you install Visual Studio 2008, you can built-in AJAX control library. This Ajax Library contains plenty of rich AJAX controls like Menu, TreeView, webparts and also these components support JSON and VS 2008 contains in built ASP.NET AJAX Control Extenders. 6. JavaScript Debugging Support Since starting of web development all the developers got frustration with solving javascript errors. Debugging the error in javascript is very difficult. Now Visual Studio 2008 makes it is simpler with javascript debugging. You can set break points and run the javaScript step by step and you can watch the local variables when you were debugging the javascript and solution explorer provides javascript document navigation support. 7. Nested Master Page Support Already Visual Studio 2005 supports nested master pages concept with .NET 2.0, but the problem with this Visual Studio 2005 that pages based on nested masters can't be edited using WYSIWYG web designer. But now in VS 2008 you can even edit the nested master pages. 8. LINQ Intellisense and Javascript Intellisense support for silverlight applications Most happy part for .NET developers is Visual Studio 2008 contains intellisense support for javascript. Javascript Intellisense makes developers life easy when writing client side validation, AJAX applications and also when writing Silverlight applications Intellisense Support: When we are writing the LINQ Query VS provides LINQ query syntax as tool tips. 9. Organize Imports or Usings We have Organize Imports feature already in Eclipse. SInce many days I have been waiting for this feature even in VS. Now VS contains Organize Imports feature which removes unnecessary namespaces which you have imported. You can select all the namespaces and right click on it, then you can get context menu with Organize imports options like "Remove Unused Usings", "Sort Usings", "Remove and Sort". Refactoring support for new .NET 3.x features like Anonymous types, Extension Methods, Lambda Expressions. 10. Intellisense Filtering Earlier in VS 2005 when we were typing with intellisense box all the items were being displayed. For example If we type the letter 'K' then intellisense takes you to the items starts with 'K' but also all other items will be presented in intellisense box. Now in VS 2008 if you press 'K' only the items starts with 'K' will be filtered and displayed.
  • 6. 11. Intellisense Box display position Earlier in some cases when you were typing the an object name and pressing . (period) then intellisense was being displayed in the position of the object which you have typed. Here the code which we type will go back to the dropdown, in this case sometimes programmer may disturb to what he was typing. Now in VS 2008 If you hold the Ctrl key while the intellisense is dropping down then intellisense box will become semi- transparent mode. 12. Visual Studio 2008 Split View VS 205 has a feature show both design and source code in single window. but both the windows tiles horizontally. In VS 2008 we can configure this split view feature to vertically, this allows developers to use maximum screen on laptops and wide-screen monitors. Here one of the good feature is if you select any HTML or ASP markup text in source window automatically corresponding item will be selected in design window. 13. HTML JavaScript warnings, not as errors: VS 2005 mixes HTML errors and C# and VB.NET errors and shows in one window. Now VS 2008 separates this and shows javascript and HTML errors as warnings. But this is configurable feature. 14. Debugging .NET Framework Library Source Code: Now in VS 2008 you can debug the source code of .NET Framework Library methods. Lets say If you want to debug the DataBind() method of DataGrid control you can place a debugging point over there and continue with debug the source code of DataBind() method. 15. In built Silverlight Library Earlier we used to install silverlight SDK separately, Now in VS 2008 it is inbuilt, with this you can create, debug and deploy the silverlight applications. 16. Visual Studio LINQ Designer Already you know in VS 2005 we have inbuilt SQL Server IDE feature. by this you no need to use any other tools like SQL Server Query Analyzer and SQL Server Enterprise Manger. You have directly database explorer by this you can create connections to your database and you can view the tables and stored procedures in VS IDE itself. But now in VS 2008 it has View Designer window capability with LINQ-to-SQL. 17. Inbuilt C++ SDK Earlier It was so difficult to download and configure the C++ SDK Libraries and tools for developing windows based applications. Now it is inbuilt with VS 2008 and configurable 18. Multilingual User Interface Architecture - MUI MUI is an architecture contains packages from Microsoft Windows and Microsoft Office libraries. This supports the user to change the text language display as he wish. Visual Studio is now in English, Spanish, French, German, Italian, Chinese Simplified, Chinese Traditional, Japanese, and Korean. Over the next couple of months. Microsoft is reengineering the MUI which supports nine local languages then you can even view Visual studio in other 9 local languages. 19. Microsoft Popfly Support Microsoft Popfly explorer is an add-on to VS 2008, by this directly you can deploy or hosting the Silverlight applications and Marshup objects Deployment Options Supported by .NET You can deploy an ASP.NET Web application using any one of the following three deployment options.
  • 7. XCOPY Deployment Using the Copy Project option in VS .NET Deployment using VS.NET installer XCOPY Deployment Before looking at how .NET enables XCOPY deployment, let us take a moment to understand what XCOPY deployment is. Prior to .NET, installing a component (for example, a COM Component) required copying the component to appropriate directories, making appropriate registry entries, and so on. But now in .NET, to install the component all you need to do is copy the assembly into the bin directory of the client application and the application can start using it right away because of the self-describing nature of the assembly. This is possible because compilers in the .NET Framework embed identifiers or meta-data into compiled modules and the CLR uses this information to load the appropriate version of the assemblies. The identifiers contain all the information required to load and run modules, and also to locate all the other modules referenced by the assembly. It is also refered to as zero-impact install since the machine is not impacted by way of configuring the registry entries and configuring the component. This zero-impact install also makes it possible to uninstall a component without impacting the system in any manner. All that is required to complete uninstallation is the removal of specific files from the specific directory. For performing this type of deployment, all you need to do is to go to the Command Prompt and copy over the required files to a specific directory on the server using the XCOPY command. As you can see, the XCOPY command takes a number of arguments. / E - This option copies directories, subdirectories, and files of the source argument, including empty ones. / K - This option allows you to retain all the existing file and folder attributes. When you use XCOPY to copy files or a directory tree structure, XCOPY strips off file attributes by default. For example, if a file had the read-only attribute set, that attribute would be lost after the file is copied. To retain the original attributes with the copied files, you must use the / K parameter. / R - This option overwrites files marked as read only. / O - This option preserves all security-related permission ACLs of the file and folders. / H - This option copies both hidden and system files. / I - This option tells XCOPY to assume that the destination is a directory and create it if it does not already exist. Once the folder is copied over to the target server, you then need to create a virtual directory on the target server (using Internet Information Manager MMC snap-in) and map that virtual directory to the physical directory that is created using the XCOPY command. That's all there is to deploying an ASP.NET Web application on a remote server using XCOPY Deployment. Using the Copy Project Option in VS .NET The Copy Project option in VS .NET makes it very easy to deploy ASP.NET Web applications onto the target servers. Using this option, you can copy the Web project to the same server or to a different server. If you are using VS .NET to develop Web applicatons, the first thing that you need to do before packaging an ASP.NET Web applications is to change the Active Solution Configuration from Debug to Release as shown below. This allows the compiler not only to optimize the code but also remove the debugging related symbols from the code, making the code run much faster. To bring up the Configuration Manager, select your Web project from the Solution Explorer and select Project->Properties->Configuration Properties from the menu and then click on the Configuration Manager Command button. In the Active Solution Configuration combo box, select the Release option. To copy the Web project onto the target server, select Project->Copy Project from the menu. Selecting that option will result in the following dialog box being displayed. The Copy Project dialog provides the following options. Destination Project Folder: Using this option, you can specify the location to which you want to copy the project. The location can be the same server or a remote server. Web access method: The Web access method option determines the access method that is used to copy the Web project to the destination folder. There are two types of Web access methods. File share: This option indicates that you want to directly access your project files on the Web server through a file share. It does not require FrontPage Server Extensions on the server.
  • 8. FrontPage: This option specifies that you want to use the HTTP-based FrontPage Server Extensions to transfer your project files to the server. Before using this option, make sure FrontPage Server Extensions are installed on the server. This option will automatically create the required virtual directory on the target server. Copy: The Copy option provides three types: Only files needed to run this application: this option copies built output files (DLLs and references from the bin folder) and any content files (such as .aspx, .asmx files). Most of the time, you should be able to deploy the application using this default option. All project files: this option copies built outputs (DLLs and references from the bin folder) and all files that are in the project. This includes the project file and source files. All Files in the source project folder: choosing this option will result in all the project files and any other files that are in the project folder (or subfolder) being transferred to the destination folder. To copy the Web project, select the appropriate options from the above Copy Project dialog box and click OK. This will result in the ASP.NET Web application being deployed on the target server. Deployment Using VS .NET Web Setup Project Even though XCOPY deployment and Copy Project options are very simple and easy-to-use, they do not lend themselves well to all of the deployment needs. For example, if your application requires more robust application setup and deployment requirements, VS .NET installer can be the right choice. Although you can distribute your Web application as a collection of build outputs, installer classes, and database creation scripts, it is often easier to deploy complex solutions with Windows Installer files. VS .NET provides Web setup projects that can be used to deploy Web applications. These Web setup projects differ from standard setup projects in that they install Web applications to a virtual root folder on a Web server rather than in the Program Files folder, as is the case with the applications installed using standard setup projects. Since VS .NET installer is built on top of Windows Installer technology, it also takes advantages of Windows Installer features. Before starting on a discussion of VS .NET Web Setup Project, let us understand the architecture of Windows Installer technology that provides the core foundation on top of which the VS .NET installer is built. Features Provided by VS .NET Web Setup Project The deployment project in VS .NET builds on features of the Windows installer by allowing us to perform the following operations. Reading or writing of registry keys Creating directories in the Windows file system on the target servers Provides a mechanism to register components Provides a way to gather information from the users during installation Allows you to set launch conditions, such as checking the user name, computer name, current operating system, software application installed, presence of .NET CLR and so on. Also makes it possible to run a custom setup program or script after the installation is complete. In the next section, we will see how to deploy our DeploymentExampleWebApp using the VS .NET Web Setup Project. Creating a Web Setup Project Using VS .NET Installer We will start by adding a new Web Setup Project to our DeploymentExampleWebApp ASP.NET Web application solution by selecting File->Add Project-> New Project from the menu. In the New Project dialog box, select Setup and Deployment Projects from the Project Types pane and then select Web Setup Project in the Templates pane as shown in the following figure. After creating the project, you then need to add the output of the primary assembly and the content files of the ASP.NET Web application to the setup project. To do this, right click on the DeploymentExampleWebAppSetup project in the solution explorer and select Add->Project Output from the context menu. In the Add Project Output Group dialog box, select DeploymentExampleWebApp from the Project combo box and select Primary Output from the list.
  • 9. After adding the project output, you then need to add the related Content Files (such as .aspx files, Images, and so on) to the project. To do this, again bring up the Add Project Output dialog box and then select Content Files from the list this time. It is illustrated in the following screenshot. After adding the Primary output and the Content Files to the Web Setup project, the solution explorer looks as follows: Configuring Properties through the Properties Window There are a number of properties that you can set through the properties window of the Web Setup project. These properties determine the runtime display and behavior of the Windows installer file. To accomplish this, right click on the DeploymentExampleWebAppSetup project from the solution explorer and select Properties from the context menu to bring up its properties window. The dialog box shown below appears in the screen. As can be seen from the above screenshot, the properties window provides properties such as Author, Description, Manufacturer, Support Phone and so on that can be very useful to the users (who are installing your application) of your application to get more details about your application. Installing the ASP.NET Web Application Once you have created the Windows installer file (.msi file), then installing the ASP.NET application in the target servers is very straightforward. All you need to do is to double-click on the .msi file from the Windows explorer. This will initiate the setup wizard, which will walk you through the installation steps. The following screenshot shows the first dialog box displayed during the installation. Clicking on Next in the above dialog box results in the following dialog box, where you can specify the virtual directory that will be used to host this Web application. This is one of the handy features wherein the creation of virtual directory is completely automated obviating the need for manual intervention. In part two of this article, we will see how to set specific properties (such as Directory Security, Default Document and so on) on the virtual directory as part of the installation process. In the above dialog box, you can also click on the Disk Cost... command button to get an idea of the space required for installing this Web application. Clicking on Next in the above dialog box results in the following dialog box where you are asked to confirm the installation. When you click on Next in the above dialog box, the installation will begin and the application will be installed. If the application is successfully installed, you will see the following dialog box. After installing the application, you can see the installed ASP.NET application through the Add/Remove Programs option (that can be accessed through Start->Settings->Control Panel) in your computer. From here, you can run the setup program to uninstall the application any time you want to. Caching The ability to store data in the main memory and then allow for retrieval of the same as and when they are requested. Caching is a technique of persisting the data in memory for immediate access to requesting program calls. ASP.NET supports three types of caching for Web-based applications: 1. Page Level Caching (called Output Caching) 2. Page Fragment Caching (often called Partial-Page Output Caching) 3. Programmatic or Data Caching Output Caching Output caching caches the output of a page (or portions of it) so that a page's content need not be generated every time it is loaded. In a typical ASP.NET page, every time the user views the page, the Web server will have to dynamically generate the content of the page and perform the relevant database queries (which are a very expensive task to do).
  • 10. Considering the fact that the page does not change for a certain period of time, it is always a good idea to cache whatever is non-static so that the page can be loaded quickly. In Page Output Caching, the entire page is cached in memory so all the subsequent requests for the same page are addressed from the cache itself. In Page Fragment Caching, a specific a portion of the page is cached and not the entire page. Page Output or Fragment Caching can be enabled or disabled at the Page, Application or even the Machine levels. Data Caching allows us to cache frequently used data and then retrieve the same data from the cache as and when it is needed. We can also set dependencies so that the data in the cache gets refreshed whenever there is a change in the external data store. The external data store can be a file or even a database. Accordingly, there are two types to dependencies, namely, file based and Sql Server based. There are also differing cache expiration policies Syntax: <%@ OutputCache Duration="60" VaryByParam="none" %> The above syntax specifies that the page be cached for duration of 60 seconds and the value "none" for VaryByParam* attribute makes sure that there is a single cached page available for this duration specified. * VaryByParam can take various "key" parameter names in query string. Also there are other attributes like VaryByHeader, VaryByCustom etc. The following is the complete syntax of page output caching directive in ASP.NET. <%@ OutputCache Duration="no of seconds" Location="Any | Client | Downstream | Server | None" VaryByControl="control" VaryByCustom="browser |customstring" VaryByHeader="headers" VaryByParam="parameter" %> To store the output cache for a specified duration Declarative Approach: <%@ OutputCache Duration="60" VaryByParam="None" %> Programmatic Approach: Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Public); • To store the output cache on the browser client where the request originated Declarative Approach: <%@ OutputCache Duration="60" Location="Client" VaryByParam="None" %> Programmatic Approach: Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Private); • To store the output cache on any HTTP 1.1 cache-capable devices including the proxy servers and the client that made request Declarative Approach: <%@ OutputCache Duration="60" Location="Downstream" VaryByParam="None" %> Programmatic Approach:
  • 11. Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetNoServerCaching(); • To store the output cache on the Web server Declarative Approach: <%@ OutputCache Duration="60" Location="Server" VaryByParam="None" %> Programmatic Approach: TimeSpan freshness = new TimeSpan(0,0,0,60); DateTime now = DateTime.Now; Response.Cache.SetExpires(now.Add(freshness)); Response.Cache.SetMaxAge(freshness); Response.Cache.SetCacheability(HttpCacheability.Server); Response.Cache.SetValidUntilExpires(true); • To cache the output for each HTTP request that arrives with a different City: Declarative Approach: <%@ OutputCache duration="60" varybyparam="City" %> Programmatic Approach: Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.VaryByParams["City"] = true; For the VaryByCustom attribute, the VaryByHeader attribute, and the VaryByParam attribute in the @ OutputCache directive, the HttpCachePolicy class provides the VaryByHeaders property and the VaryByParams property, and the SetVaryByCustom method. 1. Page Output Caching In Page Output Caching, the entire page is cached in memory so all the subsequent requests for the same page are addressed from the cache itself. Partial-Page Output Caching/ Page Fragment Caching In Page Fragment Caching, a specific a portion of the page is cached and not the entire page. Page Output or Fragment Caching can be enabled or disabled at the Page, Application or even the Machine levels. More often than not, it is impractical to cache entire pages. For example, you may have some content on your page that is fairly static, such as a listing of current inventory, but you may have other information, such as the user's shopping cart, or the current stock price of the company, that you wish to not be cached at all. Since Output Caching caches the HTML of the entire ASP.NET Web page, clearly Output Caching cannot be used for these scenarios: enter Partial-Page Output Caching. Partial-Page Output Caching, or page fragment caching, allows specific regions of pages to be cached. fragment caching comes from the attribute "VaryByControl". Using this attribute one can cache a user control based on the properties exposed. Syntax: <%@ OutputCache Duration="60" VaryByControl="DepartmentId" %> The above syntax when declared within an *.ascx file ensures that the control is cached for 60 seconds and the number of representations of cached control is dependant on the property "DepartmentId" declared in the control.
  • 12. Data Caching Programmatic or data caching takes advantage of the .NET Runtime cache engine to store any data or object between responses. That is, you can store objects into a cache, similar to the storing of objects in Application scope in classic ASP. Realize that this data cache is kept in memory and "lives" as long as the host application does. In other words, when the ASP.NET application using data caching is restarted, the cache is destroyed and recreated. Data Caching is almost as easy to use as Output Caching or Fragment caching: you simply interact with it as you would any simple dictionary object. Note that the Insert method allows you to simply add items to the cache using a key and value notation as well. For example to simply add an instance of the object bar to the cache named foo, use syntax like this: Cache.Insert("foo", bar); // C# Cache.Insert("foo", bar) ' VB.NET Question - Define Caching in ASP.NET. Answer - Caching technique allows to store/cache page output or application data on the client. The cached information is used to serve subsequent requests that avoid the overhead of recreating the same information. This enhances performance when same information is requested many times by the user. Question - Advantages of Caching Answer - It increases performance of the application by serving user with cached output. It decreases server round trips for fetching data from database by persisting data in the memory. It greatly reduces overhead from server resources. Question - What are the types of Caching in ASP.NET? Answer - Caching in ASP.NET can be of the following types Page Output Caching Page Fragment Caching Data Caching Question - Explain in brief each kind of caching in ASP.NET. Answer - Page Output Caching This type of caching is implemented by placing OutputCache directive at the top of the .aspx page at design time. For example: <%@OutputCache Duration= "30" VaryByParam= "DepartmentId"%> The duration parameter specifies for how long the page would be in cache and the VaryByParam parameter is used to cache different version of the page. The VaryByParam parameter is useful when we require caching a page based on certain criteria. Page Fragment Caching This technique is used to store part of a Web form response in memory by caching a user control. Data Caching Data Caching is implemented by using Cache object to store and quick retrieval of application data. Cache object is just like application object which can be access anywhere in the application. The lifetime of the cache is equivalent to the lifetime of the application. Question:-What do you mean by Share Point Portal ? Answer: Here I have taken information regarding Share Point Portal Server 2003 provides mainly access to the crucial business information and applications. With the help of Share Point Server we can server information between Public Folders, Data Bases, File Servers and the websites that are based on Windows server 2003. This Share Point Portal is integrated with MSAccess and Windows servers, So we can get a Wide range of document management functionality. We can also create a full featured portal with readymade navigation and structure.
  • 13. Question:-What is cross page posting in ASP.NET2.0 ? Answer: When we have to post data from one page to another in application we used server.transfer method but in this the URL remains the same but in cross page posting there is little different there is normal post back is done but in target page we can access values of server control in the source page.This is quite simple we have to only set the PostBackUrl property of Button,LinkButton or imagebutton which specifies the target page. In target page we can access the PreviousPage property. and we have to use the @PreviousPageType directive. We can access control of PreviousPage by using the findcontrol method. When we set the PostBackURL property ASP.NET framework bind the HTML and Javascript function automatically. Question: How to start Outlook,NotePad file in AsP.NET with code ? Answer: Here is the syntax to open outlook or notepad file in ASP.NET VB.NET Process.Start("Notepad.exe") Process.Start("msimn.exe"); C#.NET System.Diagnostics.Process.Start("msimn.exe"); System.Diagnostics.Process.Start("Notepad.exe"); Question: What is the purpose of IIS ? Answer: We can call IIS(Internet Information Services) a powerful Web server that helps us creating highly reliable, scalable and manageable infrastructure for Web application which runs on Windows Server 2003. IIS helps development center and increase Web site and application availability while lowering system administration costs. It also runs on Windows NT/2000 platforms and also for above versions. With IIS, Microsoft includes a set of programs for building and administering Web sites, a search engine, and support for writing Web-based applications that access database. IIS also called http server since it process the http request and gets http response. Question: What is main difference between GridLayout and FormLayout ? Answer: GridLayout helps in providing absolute positioning of every control placed on the page. It is easier to develop page with absolute positioning because control can be placed any where according to our requirement. But FormLayout is little different only experience Web Developer used this one reason is it is helpful for wider range browser. If there is absolute positioning we can notice that there are number of DIV tags. But in FormLayout whole work are done through the tables. Question: How Visual SourceSafe helps Us ? Answer: One of the powerful tool provided by Microsoft to keep up-to-date of files system its keeps records of file history once we add files to source safe it can be add to database and the changes ads by different user to this files are maintained in database from that we can get the older version of files to. This also helps in sharing,merging of files. Question:-Can you define what is SharePoint and some overview about this ? Answer: SharePoint helps workers for creating powerful personalized interfaces only by dragging and drop pre-defined Web Part Components. And these Web Parts components also helps non programmers to get information which care and customize the appearance of Web pages. To under stand it we take an example one Web Part might display a user's information another might create a graph showing current employee status and a third might show a list of Employees Salary. This is also possible that each functions has a link to a video or audio presentation. So now Developers are unable to create these Web Part components and make them available to SharePoint users. Question:-What is different between WebUserControl and in WebCustomControl ? Answer: Web user controls :- Web User Control is Easier to create and another thing is that its support is limited for users who use a visual design tool one good thing is that its contains static layout one more thing a separate copy is required for each application. Web custom controls:-Web Custom Control is typical to create and good for dynamic layout and another thing is it have full tool support for user and a single copy of control is required because it is placed in Global Assembly cache. Question:-What is Sandbox in SQL server and explain permission level in Sql Server ? Answer: Sandbox is place where we run trused program or script which is created from the third party. There are three type of Sandbox where user code run. Safe Access Sandbox:-Here we can only create stored procedure,triggers,functions,datatypes etc.But we doesnot have acess memory ,disk etc. External Access Sandbox:-We cn access File systems outside the box. We can not play with threading,memory allocation etc. Unsafe Access Sandbox:-Here we can write unreliable and unsafe code.
  • 14. Question:-How many types of cookies are there in .NET ? Answer: Two type of cookeies. a) single valued eg request.cookies(”UserName”).value=”dotnetquestion” b)Multivalued cookies. These are used in the way collections are used example request.cookies(”CookiName”)(”UserName”)=”dotnetquestionMahesh” request.cookies(”CookiName”)(”UserID”)=”interview″ Question: When we get Error 'HTTP 502 Proxy Error' ? Answer: We get this error when we execute ASP.NET Web pages in Visual Web Developer Web server, because the URL randomly select port number and proxy servers did not recognize the URL and return this error. To resolve this problem we have to change settings in Internet Explorer to bypass the proxy server for local addresses, so that the request is not sent to the proxy. Question:-What do you mean by three-tier architecture? Answer: The three-tier architecture was comes into existence to improve management of code and contents and to improve the performance of the web based applications. There are mainly three layers in three-tier architecture. the are define as follows (1)Presentation (2)Business Logic (3)Database (1)First layer Presentation contains mainly the interface code, and this is shown to user. This code could contain any technology that can be used on the client side like HTML, JavaScript or VBScript etc. (2)Second layer is Business Logic which contains all the code of the server-side .This layer have code to interact with database and to query, manipulate, pass data to user interface and handle any input from the UI as well. (3)Third layer Data represents the data store like MS Access, SQL Server, an XML file, an Excel file or even a text file containing data also some additional database are also added to that layers. Question: What is Finalizer in .NET define Dispose and Finalize? Answer: We can say that Finalizer are the methods that's helps in cleanp the code that is executed before object is garbage collected .The process is called finalization . There are two methods of finalizer Dispose and Finalize .There is little diffrenet between two of this method . When we call Dispose method is realse all the resources hold by an object as well as all the resorces hold by the parent object.When we call Dispose method it clean managed as well as unmanaged resources. Finalize methd also cleans resources but finalize call dispose clears only the unmanged resources because in finalization the garbase collecter clears all the object hold by managed code so finalization fails to prevent thos one of methd is used that is: GC.SuppressFinalize. Question: What is late binding ? Answer: When code interacts with an object dynamically at runtime .because our code literally doesnot care what type of object it is interacting and with the methods thats are supported by object and with the methods thats are supported by object .The type of object is not known by the IDE or compiler ,no Intellisense nor compile-time syntax checking is possible but we get unprecedented flexibilty in exchange.if we enable strict type checking by using option strict on at the top of our code modules ,then IDE and compiler will enforce early binding behaviour .By default Late binding is done. Question:-Does .NET CLR and SQL SERVER run in different process? Answer: Dot Net CLR and all .net realtes application and Sql Server run in same process or we can say that that on the same address because there is no issue of speed because if these two process are run in different process then there may be a speed issue created one process goes fast and other slow may create the problem. Question: The IHttpHandler and IHttpHandlerFactory interfaces ? Answer: The IHttpHandler interface is implemented by all the handlers. The interface consists of one property called IsReusable. The IsReusable property gets a value indicating whether another request can use the IHttpHandler instance. The method ProcessRequest() allows you to process the current request. This is the core place where all your code goes. This method receives a parameter of type HttpContext using which you can access the intrinsic objects such as Request and Response. The IHttpHandlerFactory interface
  • 15. consists of two methods - GetHandler and ReleaseHandler. The GetHandler() method instantiates the required HTTP handler based on some condition and returns it back to ASP.NET. The ReleaseHandler() method allows the factory to reuse an existing handler. Question: what is Viewstate? Answer:View state is used by the ASP.NET page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state. State management is the process by which you maintain state and page information over multiple requests for the same or different pages. Client-side options are: * The ViewState property * Query strings * Hidden fields * Cookies Server-side options are: * Application state * Session state * DataBase Use the View State property to save data in a hidden field on a page. Because ViewState stores data on the page, it is limited to items that can be serialized. If you want to store more complex items in View State, you must convert the items to and from a string. ASP.NET provides the following ways to retain variables between requests: Context.Handler object Use this object to retrieve public members of one Web form’s class from a subsequently displayed Web form. Query strings Use these strings to pass information between requests and responses as part of the Web address. Query strings are visible to the user, so they should not contain secure information such as passwords. Cookies Use cookies to store small amounts of information on a client. Clients might refuse cookies, so your code has to anticipate that possibility. View state ASP.NET stores items added to a page’s ViewState property as hidden fields on the page. Session state Use Session state variables to store items that you want keep local to the current session (single user). Application state Use Application state variables to store items that you want be available to all users of the application. Describe the security authentication flow and process in ASP.NET? When a user requests a web page, there exists a process of security too, so that every anonymous user is checked for authentication before gaining access to the webpage. The following points are followed in the sequence for authentication when a client attempts a page request: • A .aspx web page residing on an IIS web server is requested by an end user • IIS checks for the user's credentials • Authentication is done by IIS. If authenticated, a token is passed to the ASP.NET worker process along with the request • Based on the authentication token from IIS, and on the web.config settings for the requested resource, ASP.NET impersonates the end user to the request thread. For impersonation, the web.config impersonate attribute's value is checked. What is Authentication? What are the different types of Authentication? In a client-server environment, there are plenty of cases where the server has to interact and identify the client that sends a request to the server. Authentication is the process of determining and confirming the identity of the client. If a client is not successfully identified, it is said to be anonymous. Windows Authentication Forms Authentication Passport Authentication Essentially the Windows Authentication and Forms Authentication are the famous ones, as Passport Authentication is related to a few websites (like microsoft.com, hotmail.com, msn.com etc. only).
  • 16. Windows Authentication is implemented mostly in Intranet scenarios. When a browser (client) sends a Request to a server where in windows authentication has been implemented, the initial request is anonymous in nature. The server sends back a Response with a message in HTTP Header. This Prompts a Window to display a Modal Dialog Box on the browser, where the end user may enter the "User name" and "Password". The end user enters the credentials, which are then validated against the User Store on the Windows server. Note that each user who access the Web Application in a Windows Authentication environment needs to have a Windows Account in the company network. How to avoid or disable the modal dialog box in a Windows Authentication environment? By enabling the Windows Integrated Authentication checkbox for the web application through settings in IIS. Forms Authentication is used in Internet based scenarios, where its not practical to provide a Windows based account to each and every user to the Web Server. In a Forms Authentication environment, the user enters credentials, usually a User Name and a corresponding Password, which is validated against a User Information Store, ideally a database table. Forms Authentication Ticket is the cookie stored on the user's computer, when a user is authenticated. This helps in automatically logging in a user when he/she re-visits the website. When a Forms Authentication ticket is created, when a user re-visits a website, the Forms Authentication Ticket information is sent to the Web Server along with the HTTP Request. Describe the Provider Model in ASP.NET 2.0? The Provider model in ASP.NET 2.0 is based on the Provider Design Pattern that was created in the year 2002 and later implemented in the .NET Framework 2.0. The Provider Model supports automatic creation of users and their respective roles by creating entries of them directly in the SQL Server (May even use MS Access and other custom data sources). So actually, this model also supports automatically creating the user table's schema. The Provider model has 2 security providers in it: Membership provider and Role Provider. The membership provider saves inside it the user name (id) and corresponding passwords, whereas the Role provider stores the Roles of the users. For SQL Server, the SqlMembershipProvider is used, while for MS Access, the AccessMembershipProvider is used. The Security settings may be set using the website adminstration tool. Automatically, the AccessMembershipProvider creates a Microsoft Access database file named aspnetdb.mdb inside the application's App_Data folder. This contains 10 tables. Describe the Personalization in ASP.NET 2.0? ASP.NET 2.0 Personalization - Personalization allows information about visitors to be persisted on a data store so that the information can be useful to the visitor when they visit the site again. In ASP.NET 2.0, this is controlled by a Personalization API. Before the Personalization Model came into existence, the prior versions of ASP.NET used of the old Session object to take care of re-visits. Now comes the Profile object. In order to use a Profile object, some settings need to be done in web.config. The example below shall explain how to use a profile object: //Add this to System.Web in web.config <profile> <properties> <add name="FirstName" type="System.String"/> </properties> </profile> 'In Page_Load event, add the following... If Profile.FirstName <> "" Then
  • 17. Panel1.Visible = False Response.Write("Welcome Back Dear :, " & Profile.FirstName & ", " & Profile.LastName) Else Panel1.Visible = True End If 'Here is the code how to save the profile properties in an event to save it Profile.FirstName = txtFirstName.Text Explain about Generics? Generics are not a completely new construct; similar concepts exist with other languages. For example, C++ templates can be compared to generics. However, there's a big difference between C++ templates and .NET generics. With C++ templates the source code of the template is required when a template is instantiated with a specific type. Contrary to C++ templates, generics are not only a construct of the C# language; generics are defined with the CLR. This makes it possible to instantiate generics with a specific type in Visual Basic even though the generic class was defined with C#. Why we use Serialization? Serialization of data using built-in .NET support makes persistence easy and reusable. Most uses of serialization fall into two categories: persistence and data interchange. Persistence allows us to store the information on some non-volatile mechanism for future use. This includes multiple uses of our application, archiving, and so on. Data interchange is a bit more versatile in its uses. If our application takes the form of an N-tier solution, it will need to transfer information from client to server, likely using a network protocol such as TCP. To achieve this we would serialize the data structure into a series of bytes that we can transfer over the network. Another use of serialization for data interchange is the use of XML serialization to allow our application to share data with another application altogether. As you can see, serialization is a part of many different solutions within our application. What is Serialization? Serialization is the process of converting an object, or group of objects, into a form that can be persisted. When u serialize an object, you also serialize the values of its properties. How Do You Use Serialization? Serialization is handled primarily by classes and interfaces in the System.Runtime.Serialization namespace. To serialize an object, you need to create two things: • A stream to contain the serialized objects. • A formatter to serialize the objects into the stream. The Role of Formatters in .NET Serialization A formatter is used to determine the serialized format for objects. All formatters expose the IFormatter interface, and two formatters are provided as part of the .NET framework: • BinaryFormatter provides binary encoding for compact serialization to storage, or for socket-based network streams. The BinaryFormatter class is generally not appropriate when data must be passed through a firewall. • SoapFormatter provides formatting that can be used to enable objects to be serialized using the SOAP protocol. The SoapFormatter class is primarily used for serialization through firewalls or among diverse systems. The .NET framework also includes the abstract Formatter class that may be used as a base class for custom formatters. This class inherits from the IFormatter interface, and all IFormatter properties and methods are kept abstract, but you do get the benefit of a number of helper methods that are provided for you.