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");
}
}
}

1 July 2011

What is dotnet Framework?

What is Framework?
-A reusable set of libraries or classes for a software system (or subsystem).

What is dotnet Framework?
-The .NET Framework is an integral Windows component that contains two main components:
the common language runtime and the .NET Framework class library.

common language runtime - Interoperability between languages in dotnet.
.NET Framework class library - Used for Reusability

Dotnet framework used to develop windows ,web,webservices etc


Server.Transfer v/s Response.Redirect in asp.net

Server.Transfer v/s Response.Redirect in asp.net

-Both these are used to transfer one page to another page in asp.net.

-Response.Redirect(“newpage.aspx”) and Server.Transfer(“newpage.aspx”)

Difference between Server.Transfer and Response.Redirect in asp.net

- Response.Redirect sends the request for the new page to the browser then browser
sends the request for the new page to the webserver.
- but in the case of Server.Transfer it directly communicate with the server to change
the page hence it saves a roundtrip in the whole process.
-If you are using Server.Transfer then you can directly access the values,
controls and properties of the previous page
-But in Response.Redirect, it is not possible.

-Server.Transfer retains the original URL in the browser’s address bar.
It just replaces the contents of the previous page with the new one.
-Response.Redirect can be used for both .aspx and html pages whereas Server.Transfer
can be used only for .aspx pages and is specific to ASP and ASP.NET.


Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...