ASP.NET interview notes part 7

A journey to ASP.NET interview notes with Nishant Kumar, founder of www.careerride.com

Follow me on FACEBOOK for Job updates and other interview related articles

<<Previous   Next>>

Steps to be taken before deployment of application

Set the build options:
Make the project compatible with an earlier Microsoft .NET. Select the Enable Optimizations check box to make the compiled code smaller, faster, and more efficient. Disable integer overflow checks:Allow classes to be used from the Component Object Model (COM).

Identify the application: To identify your application, open the AssemblyInfo file and enter the application’s information. 

Configure the application: Configuration files are Web.config and Machine.config. 

The Machine.config file located in the Windows\Microsoft.NET\Framework\version\config directory. Machine.config sets the base configuration for all .NET assemblies running on the server.

Web.config Attributes: Compilation, CustomErrors, Authentication, Authorization, Trace, SessionState, Globalization.

The global assembly cache (GAC) is a special subfolder within the Windows folder that stores the shared .NET components. When you open the folder, Windows Explorer starts a Windows shell extension called the Assembly Cache Viewer (ShFusion.dll)

You can install strong-named .NET components by dragging them into the Assembly Cache Viewer, or by using the Global Assembly Cache tool (GacUtil.exe).

Monitoring the Server: Windows provides MMC snap-ins for monitoring security, performance, and error events.
Event Viewer snap-in: Lists application, system, and security events on the system.
Performance snap-in: Lets you create new events to display in the Event Viewer.

Tuning Deployed Applications

ProcessModel element’s attributes in the server’s Machine.config file: control the number of threads and the time-out behavior etc.

Use the sessionState element’s attributes in the application’s Web.config file: control how session state information is saved. 

ProcessModel Attributes
Maximum number of requests to be queued, How long to wait before checking whether a client is connected, How many threads to allow per processor etc. 

Optimization Tips
Turn off debugging for deployed applications.

Avoid round-trips between the client and server.

Turn off Session state if it isn’t needed.

Turn off ViewState for server controls that do not need to retain their values. Use stored procedures with databases.

Use SqlDataReader rather than data sets for read-forward data retrieval. 

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. 

A Web application running on a single server that has multiple CPUs is called a Web garden and application running on multiple servers is called a Web farm

Web Garden Attributes in processModel are

webGarden:
Set to “true” to run applications on more than one processor on this server.

cpuMask: Specifies which CPUs should run ASP.NET Web applications. 

Multiple Servers
For multiple servers to handle requests for a single HTTP address, you need to install load balancing to your network. Load-balancing services can be provided by hardware or software solutions. 

Running a web application on multiple servers requires that you take special steps to handle application and session state information. To share data across multiple sessions in a web garden or web farm, you must save and restore the information using a resource that is available to all the processes. This can be done through an XML file, a database, or some other resource using the standard file or database access methods. You can share session state using: A state server, as specified by a network location. A SQL database, as specified by a SQL connection. 

ASP.NET Web applications also 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. 

Types of Tests
Unit test, Integration test, Regression test, Load test (also called stress test), Platform test. 

Web user controls combine one or more server or HTML controls on a Web user control page. User controls create a single visual component that uses several controls. User controls can be used on Web forms throughout a project. User controls are not compiled into assemblies. 

Steps to create user control

Add a Web user control page (.ascx) to your project.

Draw the visual interface of the control in the designer.

Write code to create the control’s properties, methods, and events.

Use the control by dragging it from Solution Explorer to the Web form.

Use the control from a Web form’s code by declaring the control at the module level. 

Composite custom controls combine one or more server or HTML controls composite custom compiles to create an assembly (.dll) 

Rendered custom controls are created almost entirely from scratch.

Caching

@OutputCache page directive caches a Web form in the server’s memory.

OutputCache directive has two required attributes: Duration and VaryByParam.

The VaryByParam attribute caches multiple responses from a single Web form. VaryByParam to None caches only one response for the Web form. 

XSL Transformations
XSL transformations generate formatted output from an XML input file. XSL positions elements anywhere on the Web form. XSL performs logical operations like repeating and conditional operations. XSL places structured data on a Web form. 

Steps to perform an XSL transformation in ASP.NET

Add an XML server control to a Web form.

Set the control’s DocumentSource property to the XML file to format.

Set the TransformSource property to the XSL file to use to format the output. 

Creating an XML File
XML files describe structured data in text format. XML identifies data items using tags. Each item must have a begin tag and an end tag. Item tag names are case sensitive. Attribute values must always be enclosed in double quotation marks. The nested items must be terminated before the containing item is terminated. The XML structure is strictly hierarchical. XML refers to the items in this hierarchy as XML nodes. Nodes have parent-child relationships that are identified using the XPath. 

Globalization Approaches in ASP.NET
Create separate web application corresponding to each culture, detect the culture and redirect to appropriate application. Create single web application and adjust output at run time as per culture detected. Create a single Web application that stores culture-dependent strings in resource files that are compiled into satellite assemblies. At run time, detect the user’s culture and load strings from the appropriate assembly.

<<Previous   Next>>
Explain how authorization works in ASP.NET

ASP.NET impersonation is controlled by entries in the applications web.config file. Though the default setting is no impersonation, it can be explicitly set using: ...........

Difference between Server.Transfer and response.Redirect.

Following are the major differences between them: Server.Transfer - The browser is directly redirected to another page. There is no round trip...........

How to make an application offline in ASP.NET 2.0.

Microsoft's Internet Information Services web server software is used to make an application offline. The IIS is instructed to route all incoming requests for the web site to another URL automatically.........

 



Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring