Statemanagement
Interview Questions on ASP.Net(55)
1.Define Statemanagement?
A. A new instance of the Web page class
is created each time the page is posted to the server. In traditional Web
programming, this would typically mean that all information associated with the
page and the controls on the page would be lost with each round trip. For
example, if a user enters information into a text box, that information would
be lost in the round trip from the browser or client device to the server.
To overcome this inherent limitation of
traditional Web programming, ASP.NET includes several options that help you
preserve data on both a per-page basis and an application-wide basis.
Or
Preserving the data on any server side
controls on both a per-page basis and an application-wide basis it indicates
that maintains the state of the control this is known as State Managemnent.
2.List the types of State Management
techniques?
A.There are two types of State
Management techniques.They are:
Client Side State Management
Server Side State Management
3.List the different types of Client
Side State Management techniques?
A.There are 5 different types of Client
Side State Management techniques.They are:
1.View State
2.Control State
3.Hidden Fields
4.Cookies and
5.Query Strings
4. List the different types of Server
Side State Management techniques?
A.There are 3 different types of Server
Side State Management techniques.They are:
1.Application State
2.Session State
3.Profile Properties
5. How can you manage client-side state?
A.With the help of View State,Control
State,Hidden Fields,Cookies and Query String we can manage client-side state.
6. How can you manage client-side state?
A.With the help of application
state,session state and profile properties we can manage server-side state.
7.List some of the state less
technologies?
A.ASP,ASP.NET and all the versions of
ASP.NET
8.What is View State?
A.ViewState allows the state of objects
(serializable) to be stored in a hidden field on the page. ViewState is
transported to the client and back to the server, and is not stored on the
server or any other external source. ViewState is used to retain the state of
server-side objects between postabacks.
9.What is the lifespan for items stored
in ViewState?
A.Items stored in ViewState live until
the life time of current page expires including the postbacks to the current
page.
10.Where can we store ViewState
Information?
A.Hidden Fields of HTML
11.Can you Infer drawback of View State?
A.View state can be turned off at a
page level by developers, effectively breaking your control. To solve this, the
ASP.NET page framework exposes a feature in ASP.NET called control state.
12.Define Control State?
A.The ControlState property allows you
to persist property information that is specific to a control and cannot be
turned off like the ViewState property.
13.Where we can use Control State?
A.To capture the custom control even
with round trips.
14. Define Rendering?
A.Rendering is the process of Converting Server side
control to client side control.This process is required for every web page
because every browser understands html form of out put that is Client Side
control.
15.Define Hidden Fields?
A.ASP.NET allows you to store
information in a HiddenField control, which renders as a standard HTML hidden
field. A hidden field does not render visibly in the browser, but you can set
its properties just as you can with a standard control. When a page is submitted
to the server, the content of a hidden field is sent in the HTTP form
collection along with the values of other controls. A hidden field acts as a
repository for any page-specific information that you want to store directly in
the page.
16.Can we transfer Hidden Fileds
Information from one page to another page?
A.No.We can’t this is a page specific.
17.How to store values between postbacks
in ASP.Net?
A.With the help of ViewState we can store values between postbacks in ASP.Net.
18.Define Cookies?
A.A cookie is a small amount of data
that is stored either in a text file on the client file system or in-memory in
the client browser session.
19.How many types of cookies are there?
A.There are two types of Cookies are
there.They are
1.Inmemory Cookie
2.Persistent Cookie
20.Explain what is Inmemory Cookie?
A.Inmemory Cookie is used to stores the
users information upto the user log off the session or application.These are
temporary store values.
21.Define Persistent Cookie?
A.Persistent Cookie can be store
permanently for a specified time period.Defaultly we “50 Years”.If we want we
can set manually.
E.G:HttpCookie
obj=new HttpCookie();
Obj.Expires=DateTime.Now.AddYears(1);
22.Can we kill Persistent Cookie?
A.Yes.
Obj.Expires=DateTime.Now.AddYears(-1);
23.Can we Disable Cookies at Browser
Side?
A.Yes.
24.If cookies are disabled at browser
side.Is there any draw back for that?
A.Yes.Authentication doesnot work it is
one of the threat at the security perspective.
25.What are the benefits of using
Cookies?
A.Following are the benefits of using
Cookies.They are:
1.No server resources are required as
they are stored in client.
2.They are light weight and simple to
use
26.List the Limitations of using
Cookies?
A.Following are limitation of using
cookies :-
1.Most browsers place a 4096-byte limit
on the size of a cookie, although support for 8192-byte cookies is becoming
more common in the new browser and client-device versions available today.
2.Some users disable their browser or
client device’s ability to receive cookies,thereby limiting the use of cookies.
3.Cookies can be tampered and thus
creating a security hole.
4.Cookies can expire thus leading to
inconsistency.
27.How many Kilo Bytes of Cookies can be
stored?
A.4 Kilo Bytes of data can be stored by
cookies.
28.How Cookies can be created?
A.Cookies can be created with the help
of “HttpCookies” class
E.G:HttpCookie
obj=new HttpCookie();
29.How many requests can be stored by
cookie for every application?
A.20 requests are stored by cookie for
every application.
30.Define Query String?
A.A query string is information that is
appended to the end of a page URL. Query strings provide a simple but limited
way to maintain state information.It is used to transport information from one
page to another page.
31.How Query String Stores Information?
A.It can be stored in the form of Key
and Value pair relation.Typically QueryString can be shown as below.
In the URL path above, the query string
starts with a question mark (?) and includes two attribute/value pairs, one
called "Cat" and the other called "List."
32.List the benefits of Query String?
A.Following are the benefits of using
query string for state management:-
1.No server resources are required. The
query string containing in the HTTP
requests for a specific URL.
2.All browsers support query strings.
33. List the limitations of Query
String?
A.Following are limitations of query
string :
1.Query string data is directly visible to
user thus leading to security problems.
2.Most browsers and client devices
impose a 255-character limit on URL length.
34.How can we access Query String
information in receiver page?
A.Response.
35.Define Application State?
A.ASP.NET allows you to save values
using application state — which is an instance of the HttpApplicationState
class — for each active Web application. Application state is a global storage
mechanism that is accessible from all pages in the Web application. Thus,
application state is useful for storing information that needs to be maintained
between server round trips and between requests for pages.
36.Define Session State?
A.ASP.NET allows you to save values by
using session state — which is an instance of the HttpSessionState class — for
each active Web-application session.
Session
state is similar to application state, except that it is scoped to the current
browser session. If different users are using your application, each user
session will have a different session state. In addition, if a user leaves your
application and then returns later, the second user session will have a
different session state from the first.
37.List the tasks of Session State?
A.We can use session state to
accomplish the following tasks:
1.Uniquely identify browser or
client-device requests and map them to an individual session instance on the
server.
2.Store session-specific data on the
server for use across multiple browser or client-device requests within the
same session.
3.Raise appropriate session management
events. In addition, you can write application code leveraging these events.
38.What are some ways to manage state
in an ASP.Net application?
A.Session objects, Application objects,
ViewState, cookies, hidden form fields.
39.How to Store Global Variables?
A.We can store Global variables using
Application State,Session State,Cookie,Caching .
40.Do Session use cookies?
A.No,session is stored in server memory.
41. What does the
"EnableViewState" property do? Why would I want it
on or off?
A. It allows page objects to save their
state in a Base64 encoded string in the page HTML. One should only have it
enabled when needed because it adds to the page size and can get fairly large
for complex
pages with many controls. (It takes
longer to download the page).
42.Can dataset be stored in a ViewState?
A.Yes, dataset be stored in a
ViewState.subjected to size of dataset.
43.How to set a View State for a Server
Control?
A.By Setting a EnableViewState property
44.What is the default time out for a
cookie?
A.30 minutes.
45.What is the default time out of a
session?
A.20 minutes.
46. Explain the cookie less session and
its working.
A.ASP.NET manages the session state in
the same process that processes the request and does not create a cookie. It is
known as a cookie less session. If cookies are not available, a session is
tracked by adding a session identifier to the URL.
The cookie less session is enabled using
the following code snippet:
<sessionState
cookieless="true" />
47. How can we kill a user session ?
A.Session.abandon()
48.How to redirect from one page to
another page?
A.By using
Response.Redirect() and
Server.Transfer()
Response.Redirect(Http://www.dotnetinterviewquestion.com)
Server.Transfer(“~/Home.aspx”);
49.What is the difference between
Server.Transfer() and Response.Redirect()?
A.
Server.Transfer()
|
Response.Redirect()
|
It transfer user request with in the available
pages in the root directory
|
It transfers the user request to any of the
other pages
|
It is faster in processing than
Response.Redirect()
|
It is slower in processing than
Server.Transfer()
|
It has a round trip
|
It has no round trips
|
In this we will pass query string information
|
In this we are unable to pass quey string
information
|
Syntax is
Server.Transfer("~/Home.aspx")
|
Syntax is
Response.Redirect("http://www.pv999.blogspot.com")
|
we don't need to show the real URL where we
redirected the request in the users Web Browser
|
we want our users to be able to see the new
redirected URL where he is redirected in his browser (and be able to bookmark
it if its necessary)
|
50.Which method has been introduced in
ASP.NET 4.0 to redirect a page permanently?
A.The RedirectPermanent() method added
in ASP.NET 4.0 to redirect a page permanently.
Example of the RedirectPermanent()
method:
RedirectPermanent("Aboutus.aspx");
51. What is the difference between the
Response.Write() and Response.Output.Write() methods?
A.The Response.Write() method allows you
to write the normal output; whereas, the Response.Output.Write() method allows
you to write the formatted output.
52. Explain the differences between
Server-side and Client-side code?
A.Server-side code executes on the
server.Client-side code executes in the context of the clients' browser.
53. Explain the differences between
Server-side and Clientside code?
A.Server side code is executed at the
server side on IIS in ASP.NET framework, while client side code is executed on
the browser.
54.What is Round Trip?
A.It is the process of submitting a
request from client to server and then back to the client is known as Round
Trip.
55.How to improve performance of web
page in asp.net?
A.Limited usage of unused
variables,ViewState,Session,normal sql queries apart from stored procedures.
0 comments:
Post a Comment