21. Can the HTML control retain State across postbacks?
No, by default HTML controls don’t retain state across postbacks.
22. Can you make HTML controls retain State accross postbacks?
Yes, HTML controls can retain State across postbacks, if you convert
HTML controls to Server Controls. There are 2 ways to convert HTML control to
Server Controls.
1. Right click on the HTML Control and then click "Run As Server
Control"
Or
2. Set runat="server" attribute for the Control.
23. Is ViewState supported in classic ASP?
No, ViewState is introduced in asp.net; it was not in classic asp.
When a form is submitted in classic ASP, all form values are cleared.
Suppose you have submitted a form with a lot of information and the server
comes back with an error. You will have to go back to the form and correct the
information. You click the back button, and what happens.......ALL form values
are CLEARED, and you will have to start all over again! The site did not
maintain your ViewState.
When a form is submitted in ASP .NET, the form reappears in the browser
window together with all form values. How come? This is because ASP .NET
maintains your ViewState. The ViewState indicates the status of the page when
submitted to the server.
24. Is ViewState of one page available to another page?
No, ViewState of a Page is available only in that page. You cannot
access ViewState of one page from another page.
25. Can you programmatically store and retrieve data from
ViewState?
Yes. In ASP.NET you can programmatically store and retrieve data from
ViewState.See the example below
//Save the value in ViewState object
ViewState("SomeVar") = txtFirstName.text;
//Retrieve the value from ViewState object
String strFirstName = ViewState("SomeVar").ToString();
26. Can someone view the Page HTML source and read ViewState?
No. ViewState is base-64 encoded. Hence you cannot read ViewState. If
you right click on the Page and View Source you will find __ViewState is
base-64 encoded.
27. What happens during the Page_Init event?
The server controls are loaded and initialized from the Web form’s view
state. This is the first step in a Web form’s life cycle.
28. Why is it important to monitor a deployed a Web application?
After you have deployed a Web application, you need to monitor how it
performs on the server. Many issues can crop up at this point because of :-
1. The number of users accessing the application.
2. The unpredictable nature of user interaction.
3. The possibility of malicious attack.
29. What are the 3 major steps involved in maintaining a
deployed web application?
Maintaining a deployed application is an ongoing task that involves
three major steps:
1. Monitoring the application for error, performance, and security
issues.
2. Repairing the application as issues are discovered.
3. Tuning the application to respond to user traffic.
30. What are the MMC snap-ins provided by windows for monitoring
security, performance, and error events?
The Event Viewer snap-in: Lists application, system, and
security events as they occur on the system. Use this tool to see what is
currently happening on the server and to get specific information about a
particular event.
The Performance snap-in: Lets you create new events to display
in the Event Viewer and allow you to track event counters over time for display
graphically or in report form.
31. How do run the Event Viewer to view application, system, and
security events as they happen?
To run the Event Viewer, choose Event Viewer from the Administrative
Tools submenu on the Windows Start menu. (You can show the Administrative Tools
menu in Windows XP Professional by opening the Start button’s Properties dialog
box and clicking the Customize button on the Start Menu tab. The Administrative
Tools option is located on the advanced tab of the Customize Start Menu dialog
box.) After clicking the Event Viewer shortcut, Windows displays the Event
Viewer snap-in in the MMC.
32. What are the 3 levels at which the Event Viewer snap-in
displays general application, system, and security events?
1. Informational events.
2. Warning events.
3. Error events.
33. Can you repair a deployed web application in place without
restarting the server or IIS?
Yes, to repair a deployed Web application, copy the new assembly (.dll)
and/or content files (.aspx, .ascx, and so on) to the
application folder on the server. ASP.NET automatically restarts the
application when you replace the assembly. You do not need to install or
register the assembly on the server.
34. What is ASP.NET Process recycling?
ASP.NET Web applications have a limited ability to repair themselves
through process recycling. Process recycling is the technique of shutting down
and restarting an ASP.NET worker process (aspnet_wp.exe) that has become
inactive or is consuming excessive resources. You can control how ASP.NET
processes are recycled through attributes in the processModel element in the
Machine.config file.
35. Describes the process Model attributes found in
machine.config that relate to process recycling?
1. timeout attribute :The amount of time (hh:mm:ss)
before the process is shut down and restarted. Use this setting to
automatically recycle a process after a certain number of requests as a
preventive measure.
2. shutDownTimeOut attribute : How much time each
process has to shut itself down. After this amount of time, the process is
terminated by the system if it still running.
3. requestLimit attribute : The number of queued
requests to serve before the process is shut down and restarted. Use this
setting the same way you use the timeout attribute.
4. restartQueueLimit attribute : The number of queued
requests to retain while the process is shut down and restarted.
5. memoryLimit attribute : The percentage of physical
memory the ASP.NET process is allowed to consume before that process is shut
down and a new process is started. This setting helps prevent memory leaks from
degrading the server.
6. responseRestart - DeadlockInterval : The amount of
time to wait before restarting a process that was shut down because it was
deadlocked. This setting is usually several minutes to prevent applications
with serious errors from degrading the server.
7. ResponseDeadlockInterval: The amount of time to wait
before restarting a process that is deadlocked. The process is restarted if
there are queued requests and the process has not responded within this time
limit.
36. What is the use of process Model element apart from providing
process recycling?
The process Model element in the server’s Machine.config file provides
attributes that control certain performance aspects, such as:-
1. The maximum number of requests to be queued.
2. How long to wait before checking whether a client is connected.
3. How many threads to allow per processor.
37. Describe the processModel attributes that relate to
performance tuning?
requestQueueLimit:-The number of queued requests allowed before
ASP.NET returns response code 503 (Server too busy) to new requests.
clientConnectedCheck:- The amount of time (hh:mm:ss) to wait before
checking whether a client is still connected.
maxWorkerThreads:-The maximum number of threads per processor.
maxIOThreads:-The maximum number of I/O threads per processor.
In general, lowering these settings allows your server to handle fewer
clients more quickly. Increasing these settings permits more clients and more
queued requests, but slows response times.
38. How do you turn off Session state?
To turn off Session state, in the application’s Web.config file, set the
sessionState element’s mode attribute to Off.
39. If you turn off Session State, can you use Session state
variables in code anywhere in the application?
No
40. What is Optimization?
Optimization usually refers to writing code in a way that executes more
quickly or consumes fewer resources. In general, optimizations simply reflect
the good programming practices.
41. List some of the common steps to follow to optimize a web
application for performance?
- Turn
off debugging for deployed applications.
- Code
that has been compiled with release options runs faster than code compiled
with debug options.
- Avoid
round-trips between the client and server.
- ASP.NET
uses postbacks to process server events on a page. Try to design Web forms
so that the data on the Web form is complete before the user posts the
data to the server. You can use the validation controls to ensure that
data is complete on the client side before the page is submitted.
- Turn
off Session state if it isn’t needed.
- In
some cases, you can design your code to use other techniques, such as
cookies, to store client data.
- Turn
off ViewState for server controls that do not need to retain their values.
- Saving
ViewState information adds to the amount of data that must be transmitted
back to the server with each request.
- Use
stored procedures with databases.
- Stored
procedures execute more quickly than ad hoc queries.
- Use
SqlDataReader rather than data sets for read-forward data retrieval.
- Using
SqlDataReader is faster and consumes less memory than creating a data set.
42. What does the term Scalability mean?
Web applications that serve a large number of users or that present
large amounts of data need to able to add capacity as users’ demands increase.
The ability to add capacity to an application is called scalability. ASP.NET
Web applications support this concept through their ability to run in multiple
processes and to have those processes distributed across multiple CPUs and/or
multiple servers.
43. What is the difference between a web farm and a web garden?
A Web application running on a single server that has multiple CPUs is
called a Web garden in the ASP.NET documentation. A Web application running on
multiple servers is called a Web farm.
44. If your web server has multiple processors, how can you
specify that ASP.NET runs on all or some of the CPUs?
If your server has multiple processors, you can specify that ASP.NET
runs on all or some of the CPUs by setting the web Garden attribute of the
process Model element in the server’s Machine.config file.
0 comments
Post a Comment