Dotnet Q&A

1. What are the Asp.net Page Life Cycle Events ?

PreInit
Init
InitComplete
PreLoad
Load
LoadComplete
PreRender
PreRenderComplete
Render
Unload

2. What are state management techniques in asp.net ?

state management techniques are of 2 types : client and server side

client side : a) viewstate b) querystrings c) hidden fields d) cookies
server side : a) Session b) Application State

3. what is in-proc and Out-Proc in asp.net ?

Inproc : Session will be created on the same computer memory where application is deployed.

outproc : Session will be created on some other computer memory or we can also use sql server to store session.

4. Can we have multiple machine.config file ?

No, We can only have one machine.config file

5. Can we have multiple web.config file ?

Yes, We can only have Multiple web.config file but it shud be different directives.

\\testfolder\web.config
\\testfolder\views\web.config

6. What is the difference between Response.Write() and Response.Output.Write()

The only difference between both is that response.output.write() can display a formatted text

Response.write(“Hello {0}”, “World”); // will not work
Response.output.write(“Hello {0}”, “World”); // will work

7. For how long we can have the items available stored in viewstate ?

Till we redirect to different page

8. How to improve a asp.net website performance ?

a) Disable viewstate if not in use
b) Minimize the use of session variables
c) Enable Caching where ever required
d) Reduce server round trips
e) Close and dispose the resources after the tasks has been done

9. Difference between Response.RedirectPermanent() Response.Redirect() and Server.Transfer() ?

Response.RedirectPermanent() : It will redirect to new webpage from the same domain or different domain with HTTP Status code 301, page is redirected by the browser.
(Status code 301 means Permanently redirected)

Response.Redirect() : It will redirect to new webpage from the same domain or different domain with HTTP Status code 302, page is redirected by the browser.
(Status code 302 means temporarily redirected)

Server.Transfer() : There is no status code generated as the redirection is done by server. it will only redirect to pages present in the same domain.

10. Different types of caching in asp.net ?

a) Page Caching b) Page Fragment Caching c) Data caching

11. Diff between custom and user controls ?

Custom controls are just like any other server controls and can be used around multiple applications
user controls are reusable web pages used across the same application.

12. types of asp.net validation controls ?

a) RequiredFieldValidator
b) CompareValidator
c) RangeValidator
d) RegularExpressionValidator
e) CustomValidator

13. what is difference between Private and Sealed class ?

A Private class can only be accessed by the class it is defined and contain within - it is completely inaccessible to outside classes.
A Sealed class can be accessed by any class, but can not be derived from.

Private
public class A
  {
  private class B
     {
     }
  B b = new B();
  }
public class C
  {
  A.B b = new A.B(); // ERROR
  }

Public
public sealed class A
   {
   }
public class B : A //ERROR
   {
   }

14. Default Instance mode in WCF:
Per Session


15. What is an Assembly in asp.net

An assembly is a collection of types and resources that forms a logical unit of functionality.

When you compile an application, the MSIL code created is stored in an assembly . 
Assemblies include both executable application files that you can run directly from Windows without the need for any other programs (these have a .exe file extension), and libraries (which have a .dll extension) for use by other applications.

There are two kind of assemblies in .NET;
private
shared

Private assemblies are simple and copied with each calling assemblies in the calling assemblies folder.

Shared assemblies (also called strong named assemblies) are copied to a single location (usually the Global assembly cache). 

No comments:

Post a Comment