Free Shipping Across India | Pay Cash On Delivery | Call: +91-9590677766 (Mon - Sat)

search lense
Call Us : +91-9590677766
Let us call you

Asp net interview questions for 3 years experience


Professionals who have 3 years of work experience in .NET can work on samples for all the controls and they should know about when to use which controls and where to use which logic and they should know about their current project very well. Try to know about all the controls and technology which is used in that project and try to learn or at least know about the latest technology. Now a days in interview they will ask for latest technology and Database queries.

What is the difference between login controls and Forms authentication?

  • Forms authentication can be easily implemented using login controls without writing any code.
  • Login control performs functions like prompting for user credentials, validating them and issuing authentication just as the FormsAuthentication class.
  • However, all that’s needs to be dne is to drag and drop the use control from the tool box to have these checks performed implicitly.
  • The FormsAuthentication class is used in the background for the authentication ticket and ASP.NET membership is used to validate the user credentials.

What is Fragment Caching in ASP.NET?

  • Fragment caching refers to the caching of individual user controls within a Web Form.
  • Each user control can have independent cache durations and implementations of how the caching behavior is to be applied.
  • Fragment caching is useful when you need to cache only a subset of a page.
  • Navigation bars, header, and footers are good candidates for fragment caching.

What is partial classess in .net?

When there is a need to keep the business logic separate from the User Interface or when there is some class which is big enough to have multiple number of developers implement the methods in it, the class can be separated and written in different files as partial class.

The keyword partial must appear in each class.

//syntax for C#
Public partial class MyPartialClass1

// this code could be in file1

Public partial class MyPartialClass1
// this code could be in file2

Explain how to pass a query string from an .asp page to aspx page?

Consider the following URL:

http:// localhost/form.aspx?param1=career&param2=ride

This html addresses use QueryString property to pass values between pages.

From the URL above the information obtained is:

form.aspx: which is the destination page for your browser.
Param1 is the first parameter, the value of which is set to career
Param2 is the first parameter, the value of which is set to ride

The ‘?’ marks the beginning of the QueryString
‘&’ is used as a separator between parameters.

private void formButtonSubmit_Click(object sender, System.EventArgs e)
Response.Redirect("form.aspx?Param1=" +
this.formTextfieldParam1.Text + "&Param2=" +
this. formTextfieldParam2.Text);

The above code is a submit button event handler and it sends the values of the query string to the second page.

The following code demonstrates how to retrieve these valus on the second page:
private void Page_Load(object sender, System.EventArgs e)
this.form2TextField1.Text = Request.QueryString["Param1"];
this. form2TextField2.Text = Request.QueryString["Param2"];

You can also use the following method to retrieve the parameters in the string:

for (int i =0;i < Request.QueryString.Count;i++)

What is a ViewState?

  • If a site happens to not maintain a ViewState, then if a user has entered some information in a large form with many input fields and the page is refreshes, then the values filled up in the form are lost.
  • The same situation can also occur on submitting the form. If the validations return an error, the user has to refill the form.
  • Thus, submitting a form clears up all form values as the site does not maintain any state called ViewState.
  • In ASP .NET, the ViewState of a form is maintained with a built-in state management technique keeps the state of the controls during subsequent postbacks by a particular user.
  • The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat="server"> control.
    <input type="hidden" name="__VIEWSTATE" value="CareerRide">
  • The ViewState option can be disabled by including the directive <%@ Page EnableViewState="false"%> at the top of an .aspx page
  • If a ViewState of a certain control has to be disabled, then set EnableViewState="false".

What is ViewState? Explain its benefits and limitations.

Viewstate is used to maintain or retain values on postback. It helps in preserving a page. Viewstate is internally maintained as a hidden field in encrypted form along with a key.


i) No server resources.
ii) Viewstate ensures security because it stores the data in encrypted format.
iii) Viewstates are simple. They are used by enabling or disabling the viewstate properties.
iv) It is based on the wish of developer that they want to implement it at the page level or at control level.


i) If large amount of data is stored on the page, then page load might cause a problem. 
ii) Does not track across pages. Viewstate information does not automatically transfer from page to page.

Difference between src and Code-Behind

With the ‘src’ attribute, the source code files are deployed and are compiled by the JIT as needed. 
Though the code is available to everyone with an access to the server (NOT anyone on the web), this method is preferred as it does away with the compilation of the DLLs.

‘CodeBehind’ attribute just has the VS.NET associate the code file with the aspx file. This is necessary since VS.NET automates the pre-compiling that is harder by hand.

Due to this the ‘Src’ attribute is done away with having only a DLL to be deployed enhancing the protection level even though it can be decompiled.

What is the difference between URL and URI?

A URL (Uniform Resource Locator) is the address of some resource on the Web. A resource is nothing but a page of a site. There are other type of resources than Web pages, but that's the easiest conceptually.

A URI is a unique identifier to usually a namespace. 
Though it looks like a URL but it doesn’t have to necessarily locate any resource on the web.

URI is a generic term. URL is a type of URI.

What is the Pre-Compilation feature of ASP.NET 2.0?

Previously, in ASP.NET, the pages and the code used to be compiled dynamically and then cached so as to make the requests to access the page extremely efficient. In ASP.NET 2.0, the pre-compilation feature is used with which an entire site is precompiled before it is made available to users.

There is a pre-defined folder structure for enabling the pre-compilation feature:

  • App_Code: stores classes
  • App_Themes: stores CSS files, Images, etc.
  • App_Data: stores XML files, Text Files, etc.
  • App_GlobalResources: stores all the resources at global level E.g. resx files, etc
  • App_LocalResources: stores all the resources at local/Page level

How can we create custom controls in ASP.NET?

Custom controls are user defined controls. They can be created by grouping existing controls, by deriving the control from System.Web.UI.WebControls.WebControl or by enhancing the functionality of any other custom control. Custom controls are complied into DLL’s and thus can be referenced by as any other web server control.

Basic steps to create a Custom control:

1. Create Control Library
2. Write the appropriate code
3. Compile the control library
4. Copy to the DLL of the control library to the project where this control needs to be used
5. The custom control can then be registered on the webpage as any user control through the @Register tag.

What is an application domain?

It's a way in CLR to maintain a boundary between various applications to ensure that they do not interfere in working of any other application. CLR acts as a mini operating system where a single process may have various application domains.

Explain the concepts of application domain.

  • An operating system process can have many ongoing application domains. Application Domains keep an application separate.
  • All objects created within the same application scope are created within the same application domain.
  • Multiple application domains can exist in a single operating system process,
  • Distinct memory address space allocation by the OS is effective but expensive and it does not satisfy to the numbers required for large web servers.
  • However, the CLR isolates an application by managing the memory use of code running within the application domain due to which the code cannot access memory outside the boundaries of the domain.

Explain the two different types of remote object creation mode in .NET.

Ways in which object can be created using Remoting: -

SAO Server Activated Object (call mode): lasts the lifetime of the server. They are activated as SingleCall/Singleton objects. It makes objects stateless. A SingleCall object gets created for each request by client and A Singleton object is created once on the server and is shared by all the clients.

CAO (Client Activated Objects): CAO creates stateful objects. The object creation request is based on the request by client side. Therefore, the lifetime is based on client and not server. Single instance of object is created for every call.

Describe SAO architecture of Remoting.

Remoting has at least three sections:-

1. Server
2. Client: This connects to the hosted remoting object
3. Common Interface between client and the server .i.e. the channel

Remoting takes an indirect approach to application domain communication by creating proxy objects. Communication is performed as below:

a. When a client object wants to create an instance of the server object, the remoting system at the client creates a proxy of the server object. The proxy object is at the client but behaves exactly like the remote object i.e. the server object.

b. The proxy passes the call information to the remoting system on the client. Client remoting system then sends the information to the remoting system on the server which then invokes the actual method on the server object. The remoting system on the server then passes the result information back to the client remoting system.

c. The client remoting system returns the results to the client object through the proxy.

Explain Singleton architecture of Remoting.

Singleton architecture is to be used when all the applications have to use or share same data.

Define LeaseTime, SponsorshipTime, RenewOnCallTime, LeaseManagePollTime.

Terms related to lifecycle of a remoting object.

The LeaseTime property protects the object so that the garbage collector does not destroy it as remoting objects are beyond the scope of the garbage collector. Every object created has a default leasetime for which it will be activated. Once the leasetime expires, the object is eligible again for garbage collector and is eventually destroyed. Default value is 5 minutes.

Even though the leasetime of an object has expired, there still may be clients who would still need the remoting object on the server. In such cases the leasemanager keeps a track of such clients and asks them if they need the object and are ready to extend or sponsor the object to extend its existence. This is done through SponsorshipTime property, which is then based on the sponsor.

The RenewOnCallTime property defines the duration for which a remoting object's lease is extended if a sponsor is found. The default value is 2 minutes.

The LeaseManager class has a property PollTime, which defines the frequency at which the LeaseManager polls the leases. Default is 10 seconds.

Briefly explain how to specify remoting parameters using config files.

The remoting parameters can be specified through both programming and in config files. All the settings defined in config files are placed under <system.runtime.remoting>

<application> is placed under system.runtime.remoting but the name attribute of application tag specifies if the parameter is for server or client. RemotingConfiguration.Configure is used to access the configuration keys for remoting properties.

What is marshalling? Explain types of marshalling.

Marshaling is a process of transforming or serializing data from one application domain and exporting it to another application domain.

Two types of marshalling

  • Marshal by value: a copy of an object is created by the server and is passed and used by the client.
  • Marshal by reference: the client creates a proxy to access the object.

What is ObjRef object in remoting?

ObjRef is a searializable object returned by Marshal() that knows about location of the remote object, host name, port number, and object name.

Explain the steps of acquiring a proxy object in web services.

  • Client communicates to UDI node to retrieve a list of available web services that the client has access to.
  • Every service listed has a URI pointing to the service's DISCO or WSDL document, which is needed to access the webservice and its 'webmethod" methods.
  • After interpreting the DISCO document, follow the URI for the WSDL document related to the chosen webservice.
  • Client then adds and parses the WSDL document and creates a proxy object which can then communicate with Webservice and access its "webmethod" methods.

Explain the steps to create a web services and consume it.

Steps to create and consume a webservice


  • a. Create a new website by selecting "ASP.NET Web Site" and giving it a suitable name.
  • b. service.cs file appears inside the solution with a default webmethod named as "HelloWorld()"
  • c. Right click on the webservice project and add a web reference instead of adding a normal reference.
  • d. A window appears that displays a list of webservices knows to the solution.
  • e. Click on "Webservices in this solution"
  • f. a search progress bar appears and
  • g. Select the service that appears in the list
  • h. progress bar appears once again.
  • i. web method appears on the screen
  • j. Click on "Add reference" button. This would add localhost
  • k. solution would have App_WebReference folder

Consumption or Usage:

  • a. Add a UI (.aspx) to the webservice project
  • b. Add a button and a label to the form
  • c. Double click the button to see the click event of the button
  • d. Create an object of type service localhost.serviceName
  • e. Write code to display the value returned by the webmethod on the label
  • f. Execute the solution by setting the added aspx as the startpage.
  • g. click on the button and the message "Hello World" would be displayed on the label