.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> ASP.Net >> Post New Question Subscribe to Interview Questions

How to find number of items in the current session collection in ASP.NET

Posted By :abhays     Posted Date :September 26, 2014    Points :40   Category :ASP.Net 
System.Web.SessionState.HttpSessionState member Count which returns the number of items in the current session collection

You can also find related Interview Question to How to find number of items in the current session collection in ASP.NET  below: 

How to Find Number of Days for provided date range?

  
Code extract :

TimeSpan DayDifference = Convert.ToDateTime("2009-1-7").Subtract(Convert.ToDateTime("2009-1-1"));


To find the difference of the days, here we have used Subtract method. The Subtract method does not take start date into consideration. Hence, to get the exact number of days for the date range we need to add one more day to the result.

Response.Write("Number of Days : " + DayDifference.Days+1); (More...)

How can we find the index of current selection in BindingSource Class?

  
Using bindingSource1.Position we can find the index of currently selected item.
Here bindingSource1 is the object of BindingSource Class. (More...)

How to find the current application file path while runtime?

  
System.Reflection.Assembly.GetExecutingAssembly().Location (More...)

How to find total number of tables in a database?

  

SELECT COUNT(*) AS [table count]
FROM [sys].[tables]

We can get the total number of tables using this query. (More...)

How would you retrieve large number of Items form the list ?

  

Ans. To retrieve large number of items with a better performance we can either use SPQuery or PortalSiteMapProvider Class. Read More with Examples
Retrieving large number of Items from sharepoint list (More...)

What is Garbage Collection in .Net? Garbage collection process?

  
The process of transitively tracing through all pointers to actively used objects in order to locate all objects that can be referenced, and then arranging to reuse any heap memory that was not found during this trace. The common language runtime garbage collector also compacts the memory that is in use to reduce the working space needed for the heap. (More...)

What is the difference between Finalize and Dispose (Garbage collection)

  
Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object.
In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object should call this method when it is done using the object. Dispose can be called even if other references to the object are alive.


Note that even when you provide explicit control by way of Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from permanently leaking if the programmer fails to call Dispose. (More...)

Minimum number of queues needed to implement the priority queue?

  
Two. One queue is used for actual storing of data and another for storing priorities. (More...)

Differences between application and session.

  
The session object maintains state on a per client basis whereas the application object is on a per application basis and is consistent across all client requests. (More...)

What are the collection classes?

  
Queue, Stack, BitArray, HashTable, LinkedList, ArrayList, Name ValueCollection, Array, SortedList, HybridDictionary, ListDictionary, StringCollection, StringDictionary (More...)

What are the collection classes?

  
The .NET Framework provides specialized classes for data storage
and retrieval.
These classes provide support for stacks, queues, lists, and hash tables. (More...)

Session state vs View state

  
In some cases, using view state is not feasible. The alternative for view state is session state. Session state is employed under the following situations:
. Large amounts of data - View state tends to increase the size of both the HTML page sent to the browser and the size of form posted back. Hence session state is used.
. Secure data - Though the view state data is encoded and may be encrypted, it is better and secure if no sensitive data is sent to the client. Thus, session state is a more secure option.
. Problems in serializing of objects into view state - View state is efficient for a small set of data. Other types like DataSet are slower and can generate a very large view state (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend