What are the different terms that are related to the life cycle of a Remoting object?

The related terms to the life cycle of a Remoting object are define as Lease Time, Sponsorship Time, RenewOnCallTime, and LeaseManagePollTime.

Lease Time: The LeaseTime property protects the object from 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.
Sponsorship Time: 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 sponsor the object to extend its existence. This is done through SponsorshipTime property.
RenewOnCallTime: 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.
LeaseManagePollTime: The LeaseManager class has a property PollTime, which defines the frequency at which the LeaseManager polls the leases. Default is 10 seconds.


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

The two different ways by which object can be created using Remoting is:-

SAO (Server Activated Object): It 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.


What is the difference between URI and URL?

URI: (Uniform Resource Identifier)  
 It is a string and its responsibility is to identify a resource by meta-information. It gives information about only one resource. This is nothing but an address of some resource (page of a site) on the Web. URI is a generic term.

The World Wide Web can be considered as a large group of resources or contents placed in different computers all around the world. These contents can be found and can link each other through URIs.

Eg. A sample URI looks like :

•    www.dotnetfunda.com
•    /some/page.html

URL: (Uniform Resource Locator)
It identifies the resource on the net and tells it is obtainable using what protocols. This is a unique identifier which is usually a namespace. Even if it looks like a URL but it doesn’t have to necessarily locate any resource on the web. URL is a type of URI.

It can only identifies where and how to find it. A common URL is composed by four parts:
•    Protocol: Also called URL scheme, this specifies which protocol is used to access the document.
•    Computer name: Gives the name of the computer (usually a domain name or IP address) where the content is hosted.
•    Directories: Sequence of directories separated by slashes that define the path to follow to reach the document.
•    File: The name of the file where the resource is located.

Sample url looks like

•    http:/www.dotnetfunda.com/users/login.aspx
Here, http is the protocol, dotnetfunda.com is the domain name users is the folder name, login.aspx is the filename
•    http://dotnetfunda.com/articles/default.aspx
Here http is the protocol, dotnetfunda.com is the domain name, articles is the folder name and default.aspx is the file name


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. It allows to cache specific portions of the page rather than the whole page.

The use of Fragment caching is to cache the subset of a page. The best examples for Fragment caching are navigation bars, headers, and footers etc.

Fragment cache is used to store user controls individually within a web form in cache instead of the whole webform.

control1:
<%@ OutputCache Duration="40" VaryByParam="none"%>

control2:
<%@ OutputCache Duration="60" VaryByParam="none"%>


Here the OutputCache duration is specified in seconds.

If control1 and control2 exist on a single webform together, the data of control1 and control2 would be cached for 40 and 60 seconds respectively based on @OutputCache directive. 


What are Partial classes 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 having multiple numbers of developers implement the methods in it, the class can be separated and written in different files called as partial class.

Below there is a sample class to know how to use partial class in case of C#
Public partial class MyPartialClass1
{
         //code
}
// this code could be in file1

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

Partial classes allow us to divide the class definition into multiple files (physically). Logically, all the partial classes are treated as a single file by the compiler.