.

Saturday, 13 April 2013

latest interview questions on asp net c# for 2 years experience

Introduction :-
I have collected the best asp.net and c#.net question with answer for experience person who have two [2] years of experience in asp.net and c#.net.
Firstly any enterviewer ask to you

1 :- How is Felling know ?
Asn :- Good ,Felling well like this you give the answer

2 :-Tell me about your self in brief ?
Good morning sir/madam.

This is Chitranjan Singh Rathore

My educational qualification are:

I have completed my 10th standard in 2002 from Little flower school and also 12th standard in 2004.

I have completed my graduation in 2007 from Holkar science college.

I have completed my post graduation in 2010 from Medicaps Colloege indore .

Coming to my family background.

My father is a private employee in banking sector.

My mother is a housewife.

I have 1 elder sister and 2 elder brother.

My personal details are.

My strength are hardworking and truth person.

My weakness are emotional and a little shy.

My hobbies are playing cricket and indoor games.

Thank you.3 :-What is asp.net life cycle ?

Life Cycle Events

PreInit

The properties like IsPostBack have been set at this time.

This event will be used when we want to:

Set master page dynamically.

Set theme dynamically.

Read or set profile property values.

This event is also preferred if want to create any dynamic controls.

Init

Raised after all the controls have been initialized with their default values and any skin settings have been applied.

Fired for individual controls first and then for page.

LoadViewState

Fires only if IsPostBack is true.

Values stored in HiddenField with id as _ViewState decoded and stored into corresponding controls.

LoadPostData

Some controls like:

Fires only if IsPostBack is true.

Some controls like Textbox are implemented from IPostBackDataHandler and this fires only for such controls.

In this event page processes postback data included in the request object pass it to the respective controls.

PreLoad

Used only if want to inject logic before actual page load starts.

Load

Used normally to perform tasks which are common to all requests, such as setting up a database query.

Control events

This event is fired when IsPostBack is true.

Use
these events to handle specific control events, such as a Button
control's Click event or a TextBox control's TextChanged event.

PreRenderRaised
after the page object has created all the controls that are required
for rendering which includes child controls and composite controls.

Use
the event to make final changes to the contents of the page or its
controls before the values are stored into the viewstate and the
rendering stage begins.

Mainly used when we want to inject custom JavaScript logic.

SaveViewState

All the control values that support viewstate are encoded and stored into the viewstate.

RenderGenerates output (HTML) to be rendered at the client side.

We can add custom HTML to the output if we want here.

Unload

Fired for individual controls first and then for page.

Used to perform cleanup work like closing open files and database connections.

5 :-How the request is handled by IIS ?

We give an URL to an
aspx page in the browser address bar and press enter. What happens next?
We get the response in terms of rendered HTML but how?

We
are requesting something from the browser, which means indirectly we
are requesting something from the Web Server, that means IIS. IIS, based
on the file extension, decides which ISAPI extension can serve the
request.

And in case of ASP.Net (.aspx) it will be aspnet_isapi_dll so the request is passed to it for processing.

When the first request comes to the website,

an application
domain is created by the ApplicationManager class where exactly the
website runs, and which creates an isolation between 2 web applications.Within
the application domain an instance of the HostingEnvironment class is
created which provides access information about the application such as
the name of the folder where the application is stored.

The basic
and main difference between cookie and session is that cookies are
stored in the user's browser but sessions can't store in user's browser.
This specifies which is best used for.

• A cookie can keep all the information in the client's browser
until deleted. If a person has a login and password, this can be set as a
cookie in their browser so they do not have to re-login to your website
every time they visit. You can store almost anything in a browser
cookie.

• Sessions are not reliant on the user allowing a cookie. They work
like a token in the browser which allowing access and passing
information while the user has opened his browser. The problem in
sessions is when you close the browser the session will automatically
lost. So, if you had a site requiring a login, this couldn't be saved as
a session but it can be saved as a cookie, and the user has to re-login
every time they visit.
cookies are nothing but a small piece of information on the client
machine. before we create a cookies we should check whether the cookies
are allowed at the browser side. They are limited in a size 4k.(they are
2 types of cookies peristant cookie , and session cookies)

Sessions cookies are stored in a server memory during the client
browser session.When the browser is closed the session cookies are lost.

9 :-Advantages and disadvantages of Session?
Following are the basic advantages and disadvantages of using
session. I have describe in details with each type of session at later
point of time.

Advantages:

It helps maintain user state and data all over the application.

It is easy to implement and we can store any kind of object.

Stores client data separately.

Session is secure and transparent from the user.

Disadvantages:

Performance overhead in case of large volumes of data/user, because session data is stored in server memory.

Overhead involved in serializing and de-serializing session data, because in the case of StateServer and SQLServer session modes, we need to serialize
the objects before storing them.

Besides these, there are many advantages and disadvantages of session
that are based on the session type. I have discussed all of them in the
respective sections below.