Session Vs Caching in asp.net
1.Session is user specific and Caching is not user specific.
2. By using Cache, we can store it in memory, and directly bind the data. the memory of the machine/server from which the source code is running from.By using Cache, we can store it in memory, and directly bind the data.
3.But Session is defined as a period of time that is shared between the web application and the user.It is only for particular user.
4.Caching is used to increase the performance of the application, and data is not frequently changing.
5.Session is used to store user specific values, and the data may or may not be frequently changing and it should be a small value.[For Performance].
6. If system is low on memory, asp.net will remove entries from Cache to free up memory.
7. Session is per user basis, so if you store a value in session, for each user different memory will be allocated. However flexibility is that you can keep different value for different user.
8. In cache value remains the same for all users and it is a memory efficient solution when you want to share a common value between different users.
Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
4 September 2011
Configuration system failed to initialize in C# Windows application
Configuration system failed to initialize in C# Windows application
This error is due to wrong settings in app.config.
This error is due to wrong settings in app.config.
15 July 2011
Difference between Temporary tables and Global Temporary Tables in Sql Server 2008
Difference between Temporary tables and Global Temporary Tables in Sql Server 2008
Temporary tables and Global Temporary tables in Sql Server 2008
-Temporary tables and Globale Temporary tables used to copy data to a sort of virtual table (or a records set) so that you can change the values with and not affect the actual data in the actual table. And then return the results of the virtual table
Difference between Temporary tables and Global Temporary Tables
-Global temporary tables are visible to all SQL Server connections but Temporary tables only accessed or used by particular user in the session .
Refer one aspx page to another aspx page or ascx page in asp.net
Refer one aspx page to another aspx page or ascx page in asp.net
add the code in aspx page or User control page .ascx code below
Support.aspx is the reference page
<%@ Reference Page="~/Support.aspx" %>
6 July 2011
HTTP Modules in asp.net
HTTP Modules in asp.net
An HTTP module is an assembly that is called on every request made to your application.
HTTP modules are called as part of the ASP.NET request pipeline and have access to
life cycle events throughout the request.
HTTP modules therefore give you the opportunity to examine incoming and outgoing requests
and take action based on the request.
Typical uses for HTTP modules include:
Security.
-Because you can examine incoming requests, your HTTP module can perform custom
authentication or other security checks before the requested page, XML Web service,
or handler is called.
Statistics and logging.
-Because HTTP modules are called on every request, you can gather request statistics and
logging information in a centralized module, rather than in individual pages.
Custom headers or footers.
-Because you can modify the outbound response, you can inject content such as custom header
information into every page or XML Web service response.
HTTP Modules vs Global.asax Files
-You can implement much of the functionality of a module in the application's Global.asax
file, which enables you to respond to application events.
-However, modules have an advantage over the Global.asax file in that they are encapsulated
and can be created once and used in many different applications.
-By adding them to the Global Assembly Cache (GAC) and registering them in the Machine.config file, you can reuse them across applications.
Http Handlers in asp.net
Http Handlers in asp.net
-ASP.NET HTTP handler is the process (frequently referred to as the "endpoint")
that runs in response to a request made to an ASP.NET Web application.
An HTTP handler can be either synchronous or asynchronous.
synchronous handler
A synchronous handler does not return until it finishes processing the HTTP request for
which it is called.
asynchronous handler
An asynchronous handler runs a process independently of sending a response to the user
Uses of Http Handlers
Http Handlers provide us functionality to create user friendly (easy to remember) Urls.
Example
4 July 2011
Get the Function name,Line number,Columnnumber of the Error in C#
//Get the Function name,Line number,Columnnumber of the Error in C#
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
CustomError();
}
catch (Exception ex)
{
StackTrace trace = new System.Diagnostics.StackTrace(ex, true);
MessageBox.Show("Function Name:"+trace.GetFrame(0).GetMethod().Name);
MessageBox.Show("Line Number: " + trace.GetFrame(0).GetFileLineNumber());
MessageBox.Show("Column: " + trace.GetFrame(0).GetFileColumnNumber());
}
}
private void CustomError()
{
throw new Exception("An error has happened");
}
}
}
Subscribe to:
Posts (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...