Friday, September 28, 2012

Complete Details about session state management in

Title:State management in

Description And Explanation:
The session setting provide following options:
1.Session mode
2.cookie less session
3.session timeout
4.optimisation of session
session mode:
It will specify when the session to be is providing different types of session modes
1.State server session
2.SQL server session
3.In process session[default]
4.Custom session[Requires manual coding]
In process session[Process dependent session]:
session maintained with in website app domain under works process is called "In process session" or process dependent session.This produce come with two problems
1.No reliability:Restoring website with erase sessions[saving web.config or restarting web server will restart website]
2.No solution for web forming
Web forming:It is running different websites on different web services as a one unit,This is implemented for load balancing
In web forming single session can not be maintained fore client
Process Independent session
In session maintained outside of website external to under process calls process independent".the external process to maintain session can be
1.State server
2.Sql server
Database server session:
This requires following steps
* start state server:State server comes with .net installation in the form of windows service
start --->run-->services.msc
then select state server --->right click and select start--->state server will be started to maintain
Configure website to state server for maintaining session
Go to application web.config file
<session state mode="state server" state connection string="tcp/ip=">

Note:state connection string requires IP address of system in which state server is running and port number of state server
TcpIp=Ipadress:port number
Note:State server will support in memory storage,data will be lost will state server is restarted and backup can not be maintained.When reg is move reliability go with sql server

Sql server session:
Sql server supports persistent storage in the form of table,This provide mode reliability with more financial investment and requires more processing
This requires following steps
*continue sqlserver with table to maintain session
.net is providing -regsql.exe utility
VS2010 command prompt--> -regsql -u "sa" -p "" -ssadd -sstype "c" -d "test"
It will place table into sql server
Configure website to maintain session with sql server
<session state mode="SQLserver"  sqlconnection string="user=sa;password="" database="test" allow customDatabse="true">

Note:Sql server agent will maintain Job to monitor session when timeout occurs  it will delete sessions
Cookie less session:
By default session ID wll be given to browser in the form of in memory Cookie,if the browser disabled cookies session can not be maintained
The solution is cookieless session providing session Id to client Browser by appending to URL is called cookies less session.
<sessionstate cookieless="usecookies
                                        false" time out=""
</session state>
Use Cookies:will provide session id in the form of cookies
Use URL will provide session Id by
Use Device Profile:Session will be given based on requested device in the form cookies
Auto Detect:It is similar to use device profile.It will verify device browser enabled cookies
True:It is similar to use URL
False:It is similar to use cookies

Wednesday, September 26, 2012

how to get duplicate records from a table in sql server

When i insert the bulk amount data from one table into another table i got problem with existing data.Here in the "products" table the "prod_code" column has already some data of import table(sales_import).For this i have checked the count of redundant(already exists) data in existing table.In this post i have given a query to get the existing data(products) in the table compare to import table(sales_import).
select count(*) from products a where exists
 select  1 from [sale_Import] b where a.prod_code = b.[Title ID]

If you want to get tha data you have to use * instead of count(*)

Monday, September 24, 2012

how to Passing parameters into a Modal Dialog Window in sharepoin 2010

The share point provide a class for crating modal dialog box i:e SP.UI.ModalDialog.Here i have given an example to create a dialog box for account result by using parameters.The parameter will be assign using args property

function ResultDialog() {
var options = {url: 'Account/Reports.aspx', autoSize: true,title:' 
args: { amt: 'Amt_Tot', category: 'sales' },dialogReturnValueCallback: Result

For the above model dialog box i passed two arguments to display the sales amount regarding order.The reports.aspx has hold the resultant output ,so i dialog box url set to this page here.

Wednesday, September 19, 2012

Optimisation of Session in

Optimisation of session is arranging session in a proper manner to improve performance of the web server.The optimisation can be applied at 2 levels
1.Page Level
2.Website Level

In the page level optimisation requires enable session state option with page directive
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2"  EnableSessionState="true"%> 

It has three properties i:e
True:Session tracking takes place ,program with be loaded for reading and writing
False:No session tracking,this will reduce processing burden on server
Read Only:Session tracking program loaded for reading,this will reduce burden compare to true

WebSite Level:Website level optimisation requires settings under web.config
<Sessionstate mode="off"/>

This will in form web server not to create sessions for website.This will reduce processing burden on web server and memory wasted will not take place

Sunday, September 16, 2012

redirect to another domain without the url changing || Redirect to another domain using URL Rewriting

This post will describes how to use Url rewriting concept to redirect and rewrite the url in applications.In URL rewriting we can use regular expression to check the conditions based on requirement.Here i have given a rule for redirect to other domain  when loading specific page in the website which has different domain names.Then the application redirect to "mydomaintest" domain home page when "home-live.aspx" will loaded.
<rule name="MBR-Enterprises" stopProcessing="true">
<match url="^home-live-(.*)$" />
<add input ="{HTTP_HOST}" pattern ="www\.mydomain\.com"  />
<action type="Redirect" url="{R:1}" redirectType="Permanent" appendQueryString="false" />
Redirect to another domain using domain Name:
Here we have to check only the domain name to redirect to desired domain
<rule name="MBR-Enterprises" stopProcessing="true">
<match url="^$" />
<add input ="{HTTP_HOST}" pattern =""  />
<action type="Redirect" url="" redirectType="Permanent" appendQueryString="false" />

Wednesday, September 12, 2012

Import Excel data into SQL Server

.In previous post i have given Import excel data to sqlserver,Export grdivew to excel .There are couple of ways(Copy and paste,Import) to save or insert the data into sql server table from excel sheet .Here i would like show how to import the data form excel sheet to sql server using sql server tasks.This is the way we can save excel data into database
When make a selection of Import for data base we will get a popup window which is used to import/Export data in sql server database

Then we have to select data source type and path of the file using the option in wizard.Here i was select Excel Sheet as data source

Here the destination data source has selected using server credentials Then click on the next button until the Wizard process completed.The below screen shots will show the complete process.

Here we can see the DVD data table which has been created using Excel sheet

Sunday, September 9, 2012

common language runtime in .Net

CLR is the run time environment in which .net application are executed CLR forms as a layer on top of the OS providing its services between .net application of OS.CLR contains several components in its architecture
1.Class Loader
2.Code Manager
3.Garbage Collector
4.Security Manager
5.Exception Manager
6.Thread Manager
7.Just time Compiler

Class Loader:
It is the provider for verify the class libraries refereed by the .net application and load all those class libraries into memory to make them available for .application

Code Manager:
In .net The code manager is responsible for loading .net application code into memory and managing until the .net application was closed.Dot net application code is classified into

1.Managed Code:The .net code that is executed by code manager is called as Managed code
2.Unmanaged Code:The .net code that is not executed by code manager is called as Managed code

Garbage Collector:
This is responsible for memory management for the .net application.When you create variables and objects in the program then allocates memory for them and De-allocating memory when their lifetime is expired is the responsibility of Garbage Collector

Security Manager:
In .net you can provide the security either by using role based security or code access security .When you provide security by using either of this then verifying the security and executing the security related code is the responsibility of security manager role based security provides the security based on the roles available in OS and code access security provides the security completely based on the own code

Exception Manager:
It is responsible for verifying whether there is any possibility for exception,raise the exception .If there is possibility,verify whether exception handling code is provided and executing is providing and otherwise terminate the program abnormal

Thread Manager:Executing multiple tasks at a time is called as multitasking .To implement multitasking you need to create threads with in the application.When you create threads within the .net application for implementing multitasking executing those threads is the responsibility of thread manager

Wednesday, September 5, 2012

Jquery LightBox example Using CSS

Title: JQuery LightBox Example And Plugin

In this post i will given how to create light box for image,content etc using jquery with CSS. We can also use JQuery light box plugin to do this kind of light box overlay.But here i just use simple jquery functions and some css properties to make light box.In the below example when we click on the image ,it will be display in light box as in below images.In this way we can create jquery lightbox using css and jquery

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("a#Main").click(function () {
$("a#Sub").click(function () {
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<a id="Main" href="#"><img src="Styles/munnar1.jpg" /></a>
<div id="lbDiv">
<img src="Styles/munnar.png" style="margin-left:45px;" />
<p align="center">
<a id="Sub" href="#"><img src="Styles/images.jpg" /></a>
CSS for Div:
 #lbDiv {
 padding:10px 15px 10px 15px;

For Jquery Light Box Library Click on this

Monday, September 3, 2012

How to get last day of the month ||End Of Month in Sqlserver 2012

In previous SQL versions we don't have any direct option to get the last day of month using current date or custom date.In Sql 2012 come up with some new built function to get End of Month value i.e EOMONTH.In this post i will given how to use this function in T-Sql.

SELECT EOMONTH ( date ) as LDM,First_Name,Addr,Country from Employee 
If we will given an input like '09/03/2012',Then the result will be like this '2012-09-30'

Saturday, September 1, 2012

difference between DLL and EXE

1.A DLL is a dynamic link library can not run indivdually and linked to the applications at runtime
 2.In DLL doesn't contains any entry point[No main function so can't run individually]
3.A program/application without main creates a DLL
4.OS doesn't create a seperate process for any DLL rather DLL will use the same process created for the EXE

1.Exe will run individually.Exe does not a supportive file rather itself an application
2.It contains entry point[main function so run individually]
3.A program/application with main creates a EXE
4.OS create a seperate process for each EXE process life that excutes