Twitter Facebook LinkedIn RSS Pinterest
  • You are here :
  • Home
  • . Net

. Net

Technical Article Section -

.Net is platform that is used for software development using various languages. It supports 44 languages and VB is its default language.

Component of .Net

  1. CLR-Common Language Runtime
  2. FCL-Framework Class Library

CLR is the run-time environment for the .Net framework. It has a component called JIT which is responsible for translating MSIL (Microsoft Intermediate language) to native code.

MSIL is the output of your source code after compilation.

CLS (common language specification) provides supports of other languages.

like-A class written in C# can inherit from a class written in VB.

CTS (common type system) provides common type system across all languages.

like-“Integer” in VB6 and “int” in C++ will convert to System.int32 which is data type of CTS.

Assembly is single deployable unit consist of three main elements. Like-Manifest , MSIL, Resources Manifest contains the meta-data information like- assembly name, version and culture etc. Meta-data describe the content within assembly like- class, interface etc.

There are two type of assembly on the basis of element Like-Single file ,Multiple file

There are the types of assembly on the basis of accessibility

  1. Private assembly that is used by single application from its root directory.
  2. Global assembly that is used by more than one assembly from the GAC (Global Assembly Cash).
  3. Satellite assembly that contains cultured resources.

Note: If you want deploy your assembly in GAC at first you have to create strong name key by using this command like- sn[space]-k keyname.snk after assigning this with assembly now you can deploy assembly in GAC either by command[gacutil] or direct past option.

Assembly can be deployed: GAC, FTP server, application rood directory.

Features of .Net: MSIL, JIT, CLS, CTL, garbage collector

Advantage of .Net:

  1. Multiplatform application
  2. Multilanguage integration
  3. Auto resource management Using this command we can run garbage collector forcefully - System.GC.Collect()


There are four types of website:

  1.  Local file system
  2. IIS website
  3. Remote website
  4. FTP website

Types of internet application:

  1. Web application: That uses client server mechanism over the internet.
  2. Web services: That proved services to other application over the internet.
  3. Peer to peer: These are standalone application that uses internet to communicate each other running their own instance.
  4. Internet enabled: These are standalone app that incorporate aspect of internet.

ASP.Net: is a platform that is used for web application development.

Parts of ASP.Net:

  1. Content: it contains html, webworms, images and other data.
  2. Programming logic: It contains scripts, DLLs and EXEs.
  3. Configuration: Determines how the application runs.

Advantage of ASP.Net:

  1. Integration with
  2. Full support of xm
  3. Inbuilt security like authentication and authorization
  4. Ability to create and customize sever control.
  5. State management.

ASP.Net model

  1. Single file page model: Code and html both are in same .ASPX physical file. Codes are in script block specifying runat server.
    1. Advantage: i. Easy to rename because there is no dependency. ii. Easy to study iii. Easy to deploy
  1. Code behind page model: codes are in one .aspx.cs files and html is in another .aspx file.
    1. Advantage: i. Offer clean separation ii. Graphics designer can work independently.

Note: J# does’t support partial class so with this language we cannot create code behind page model.

Partial class is part of a class those are integrated at time of compilation.

IIS is internet information server that hosts our web application on windows server.

Virtual Folder is a shared resource identified by an alias that represents physical location on server.

Global .asax contains global event like when application starts and end. Only one global file can exist in single root folder.

Config file contains configuration of application. This file can be more than one.

.ASPX: visual description of a form.

.ASPX.CS codes .

ASPX.REX XML: resource used by form.

.ASCX: web user control

.ASMX: web service


Types of Control

  1. Html control
  2. Webserver control
  3. User control
  4. Validation contro

Errors are handled via page level or application level

  1. Page level errors are handled using try catch block.
  2. Application level errors are handled by using a. Webconfig b. Global file

State Management the process in which we getting current position and current value of the control is called State Management.

  1. Client side: ViewState, HiddenFields, Cokkies
  2. Server side: Application state, session

View State is a client side state management object that is used to store user specific data at client side memory.

Session State is a sever side state management object that is used to store user specific data at server side memory. And each user has its own session state.

Application Sate is a global/application level managemental object which can be use like global storage media.

Authentication is a process of verifying user credential.

  1. Windows [default]
  2. Form
  3. passport

Authorization is a process of providing user accessibility.

  1. File authorization is for window authentication. We can set permission via ACL (access control list)
  2. URL

Types of Validation Control

  1. Required validator
  2. Range validator
  3. Regular expression validator
  4. Compare validator
  5. Custom validator
  6. Validation summary

These two common properties are common with each validation control.

  1. Error message
  2. Control to validate

Two web server controls that generate dynamic content

  1. Substitution control
  2. Ad rotator

Do sessions use cookies? No session is stored in server memory.

Types of session state mod:

  1. Improc kept as a live object in the webserver (aspnet_wp.exe) memory. Default session timeout time-20 Min
  2. Out Proc
    1. State Server Serialized and stored in separate process of memory (aspnet_state.exe). Used in web form architecture.
    2. SQL server Serialized and stored in SQL server database.

How to improve the performance of a web page?

Minimize the use of view state, session and turnoff tracing.

Types of caching

  1. Output caching (page caching) Stores the response from asp net pages.
  2. Fragment caching (partial caching) Stores only a portion of a page
  3. Data caching Programmatic way to cache the data.

Boxing is an implicit(automatically) conversion of value type to refernce type[object].

  1. Int i=32;
  2. Object box=I;

Unboxing is an implicit conversion of reference type[object] to value type.

  1. Int i=32;
  2. Object box=I;
  3. Int j= (int) box;

Casting is a process of converting one type to another type.

Assembly versions

  1. Major Version gets change while adding new class or project.
  2. Minor Version gets change while adding new module or new functions.
  3. Built Number gets change whenever component is built.
  4. Revision Number Automatically gets incremented during the bug fixes or patches.

We can check page is post back or not, using isPostBck property.

Tracing provide dygonastic information a page. Page level tracing add this (“trace=true”) to page directive. Application level tracing add this (“trace enable=true”) in config file.

Command to configure SQL server in membership like- aspnet_regsql.exe

Hyper link doesn’t support click event it works on link navigation.


1. Difference b/w Response. Redirect and Server. Transfer?

  1. In case of Server.Transfer[S.T] redirection is done by server whereas in case of Response.Redirect[R.R] redirection is done by client browser.
  2. In case of S.T URL remains same whereas in case of R.R will get change so that there is one more round trip. 
  3. Server.Transfer method can only work when the page is at the same server, but the Response.Redirect method can be transferred when the server is at a different place. 

For Example: If you use Server.Transfer such as follows:

  protected void btn_Click(object sender, EventArgs e)//error occurs




 protected void btn_Click(object sender, EventArgs e)//working fine.




1.1. Difference b/w GET and POST methos?

Both methods are used to transfer data from client to server. but the difference :-

In case of Get data is passed from client in the form of URL which is not secure due visibility of everyone. And there is some limitation like 1024 characters can be passed by URL. Whereas on the case of post Method data will be passed through http headers  so using secure http protocol and data will be more secure and also we have no data restriction there we can pass large number of data and binary data we can pass here also. 

Note: user both method in BasePage.aspx page respectively and see the output.  

2. Difference b/w user control and custom control?

Custom controls are DLLs so it can be place inside the toolbox whereas user control is a web page so it cannot be place into the toolbox.

3. Difference b/w manifest and metadata?

Manifest contains the metadata information like- assembly name, version, culture. Whereas metadata describe the content within assembly like – class, interface etc.

4. Difference b/w label and litral control?

  1. Litral control doesn’t support style to its content whereas label does.
  2. Litral control doesn’t add any html tag whereas label does.

5. Diff b/w view state and hidden fields?

  1. View sate works only page is post back itself whereas hidden fields works for itself and other.
  2. View state supports structural vale whereas hidden fields not.

6. Diff b/w struct and class?

  1. Struct is value type stored as a stack whereas class is reference type stored as heap.
  2. Struct doesn’t support inheritance whereas class does
  3. By default all member of struct are public whereas in case of class not
  4. Struct doesn’t need constructor whereas class need.

7. Diff b/w dispose and finalize method?

.Net framework automatically runs finalized destructor to destroy object from the memory that is no longer in use. Whereas in case of dispose, we need to explicitly call this method to release resources such as data base connections.

8. Diff b/w session state and application state?

  1. Application State is static whereas session state is dynamic.
  2. Session has timeout property whereas application doesn’t have.

9. Diff b/w DLL and EXE?

  1.  And exe is excitable program whereas DLL is a dynamic link library.
  2.  DLL is an in-process component where both component and consumer will share same memory. Whereas EXE is an out-process component where it will run in its own memory.
  3. EXE has main function so it can be directly executable whereas DLL don’t have main function so it cannot.

10. Process is an exciting instance of an application. A process can have multiple threads. Processes are independent whereas threads are interdependent.

11. Thread is an instance of a process. Threads are used for small task so it is called lightweight process. Threads within same process share same memory address whereas processes don’t share same address.

12. Execute Reader () execute SQL query and return the result set into SQL data adapter.

13. Execute Scalar () execute SQL query and return 1st column of the 1st row as a result set.

14. Execute None Query () execute SQL query and return no of row affected as a result set.

15. Diff b/w “Data Reader “and “Data adapter”?

  1. DataReader is a connection oriented ready only and far word only record set
  2. DataReader is connected to database whereas dataset connected to XML.
  3. DataReader operation is faster than dataset data set.
  4. DataAdapter servers as bridge between dataset and data source.

16. Diff b/w convert.ToString () and i.ToString ()?

Convert.ToString () converts null value whereas i.ToString () doesn’t support null values so it through null value exception.

17. Diff b/w Int.Pars and Convert.Toint32?

Convert.Toint32 converts null value whereas Int.Pars doesn’t support null values so it through null value exception

18. Diff b/w string and strinbuilder?

Strinbuilder supports a variety of operations whereas with string you cannot perform variety of operations

19. Diff b/w String and string?

String is alias name of String that is created by Microsoft.

20. Diff b/w a.equal (b) and a==b?

  1. In case of value type
    1. A==b (true)
    2. A.equal(b)(true)
  1. In case of reference type
    1. A==b (false)
    2. A.equal(b)(true)

21. Diff b/w namespace and assembly?

  1. Assembly is a physical grouping of logical unit whereas namespace is logical grouping of classes.
  2. Namespace can span multiple assemblies.

22. Diff b/w debug and trace class?

Documentation looks the same. Debug class is used for debug builds whereas trace class is used for both debug and release builds.

23. Event bubbling process of passing events to the container control by child control is called event bubbling.

24. Managed Code codes that run inside the CLR environment is called managed code. In sort all MSIL s are managed code. But if you are using some third party software like VB6 or VB++ component then these are unmanaged code because compiler doesn’t have control over them.

25. Role of

  1. Inetinfo.exe (IIS)
  2. Aspnet-isapi.dll takes care of page request and pass it to the actual worker process (aspnet_wp.exe).

26. Whey we always write static with main function?

When program is lunched, no instance of any class is present in memory. As the main method is static so it can be called without creating any instance. Then we can assume the control of program.

27. Diff b/w class file and web services?

  1. Class files contain classes and methods which are not serialized so when class file travel over the internet, it cannot get response with similar structure. Whereas web service is serialized
  2. Class file doesn’t expose the methods while web services do. To expose the method in web service [Web Method] attribute is necessary before the method

28. Diff b/w WCF and web services?

  1. Web service can be accessed only over the http. Whereas WFC is flexible because WCF can be hosted in different types of applications like IIS, WAS, self-hosting
  2. Web service use XML serialization whereas WCF use data contract serialization

29. Post back is the process in which data send back to same page on server.

30. Cross page posting is used to submit value from one page and retrieve that value from another page. like

If (previous page !=null && previous page.IsCrossPagePostBack )

{ TextBox tt=(TextBox) previous page.FindControl(tt); }

31. DLL hell?

  1. I have 2 app, a1 and a2 installed on my PC
  2. Bothe of these used shared assembly shared.dll
  3. Now I have latest version of app a1 avail on net
  4. I install it now my shared.dll has been overwritten which is used by app a1 and a2 also
  5. Now app a2 fails whereas app a1 working fine f. This is because newly installed shared.dll in not backword compactivility.

Sol: versioning is the solution of this above problem.

32. What namespace does the webpage belongs?


33. What is the top .net class that everything is deriving from?


34. Smart Navigation cursor position is maintained when page gets refreshed due to server side validation.

35. Resposnse.Out.Write allows users to write formatted output.

36. Combination of html and server control is called composite control.

37. Web.config applies setting to each web application. Whereas machine.config file apply setting to all ASP.Net application

38. Delegate is a reference type variable that holds a reference to method. It can be changed at runtime.

  1. Single Cast deltegate contains reference to one method at runtime and use System.delegate class
  2. Multicast delegate contains one invocation list of multiple method and use Sytem.multicast class

39. Style and Layout information into a separate group of files collectively called theme.

40. Default skin automating apply settings to all control of same type. a. Note a control skin is a default skin if it doesn’t have skin id attribute.

41. Name skin with skin id properties a. At page level i. %@page language=... theme=”theme1”% b. At application level i. In Config file page theme="theme1

42. Removing theme enable theming =”false” at page level.

43. Web form is group of two or more servers used to host same site. Web forms increases the website capacity of website and improve overloading. Usually used for high traffic.

44. Web Garden web application is hosted using multiple processors on same server.

Interview Questions and Answers +
Const V/s ReadOnly Constants are immutable values which are known at compile time and do not change their values for the life of the program.  Readonly variables are also immutable values which are known at run time and do not change their values for the life of the program.
  1. A const field is a compile-time constant whereas the readonly run time constants.
  2. Const fields has to be initialized at the time of declaration only whereas readonly fields can be initialized at the time of declaration or in the constructor.
  3. Const variables can declared inside methods whereas readonly cannot be declared in methods.
  4. Const fields cannot be used with static modifier, while readonly fields Can be used with static modifier.


The is operator checks if an object can be cast to a specific type or not and return Boolean result.

if (someObject is StringBuilder) ...

The as operator attempts to cast an object to a specific type, and returns null if it fails.

StringBuilder b = someObject as StringBuilder;

if (b != null) ...

Named Vs Optional parameteres