Interview FAQs

To calculate the number of days between two dates in Asp.Net using C#, use the below piece of code.

TimeSpan timespan = Convert.ToDateTime("2009-12-31").Subtract(Convert.ToDateTime("2009-01-01"));

Here we use Subtract method to find the difference between two dates. Usually the Subtract method return a value that is one less than the correct value. So to the Timespan object Days property we can add 1 to get the exact number of days.

There are 5 objects in ADO.Net.
They are Connection, Adapter, Command, Reader and Dataset.
Generics are only supported on version 2.0 and above of the Microsoft .Net framework, as well as version 2.0 of the compact framework.
To deploy and run code that uses generics you need version 2.0 or higher of the .Net runtime.
A language should comply with the Common Language Runtime (CLR) standard to become a .Net language. In .Net, code is compiled to Microsoft Intermediate Language (MSIL). This is called as Managed Code. This Managed code is run in .Net environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.
Web Forms are an ASP.Net technology that you use to create programmable Web pages. Web Forms render themselves as browser-compatible HTML and script, which allows any browser on any platform to view the pages. Using Web Forms, you create Web pages by dragging and dropping controls onto the designer and then adding code, similar to the way that you create Visual Basic forms. For more information, see ASP.NET Web Pages Overview.
The lifetime of the server object is determined by the lifetime lease. This is defined by implementing ILease interface when writing the class code.


You can define the lease of the object by implementing the ILease interface at the code time.
Use the Cookie.Discard Property which Gets or Sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the hard disk when a session ends.
System.Net.Mail is the namespace used to send email if you are using the .Net 2.0 (or higher) Framework.
PreviousDisplaying 31 of 46Next
Need Help? Contact Us.

Log in


Forgot password?


New User