Related Posts Plugin for WordPress, Blogger...

About

Follow Us

Showing posts with label State Management. Show all posts
Showing posts with label State Management. Show all posts

Thursday, 19 March 2015

In this article I will give you overview of State management in Asp.NET. I will try to cover both types of state management in this article i.e. client side and Server Side.
 
State management is a technique by which we can maintain the state of web page, controls and objects over multiple requests for same or different pages. All the Asp.net web application is stateless.
 
Hyper Text Transfer Protocol (HTTP) is a stateless protocol. It doesn’t hold the state of previous website that we visited before closing our browser that is called state less.
 
So to maintain state of object, we use State management techniques in asp.net websites.
 
Types of State Management:
 
There are two types of state management:
 
 1.  Client Side state management
 
 2.  Server side state management
 
 
Client Side state management:
I this type of state-management information will be stored on client’s machine.
 It does not use the server resources and store the information in html page, HTTP request or on disk cache of machine. Data is not secure in this type of state management, but faster than server side in performance and also support for multiple browsers. 
 
Type of Client side state management:
 
a) View-State
 
b) Hidden fields
 
c) Cookies
 
d) Query string
 
e) Control state 
 
Server Side state management:
 
In this type of state management information will be stored on server. Server side state management provides better security and reduces the bandwidth. But it is slow when compared to client side management.
 
Following are the Server side state management option that we use:
 
a) Session State
 

b) Application State

Friday, 6 February 2015

What is cookie?

Practically, cookie is a small text file sent by web server and saved by web browser on client machine. A cookie is a small piece of text file stored on user's computer in the form of name-value pair. We use cookies to small information on client’s computer. Common use of cookies is to remember users between visits.
Cookies are used by websites to keep track of visitors e.g. to keep user information like username etc. If any web application using cookies, Server send cookies and client browser will store it. The browser then returns the cookie to the server at the next time the page is requested. The most common example of using a cookie is to store User information, User preferences, Password Remember Option etc.

Monday, 2 February 2015

It is often required to get and store user email through contact us form, login form etc. But it is also highly important to check the validity of the Email address submitted by the user before storing to ensure that the email address is valid.
In this article i have explained how to get current date in dd/mm/yyyy format in asp.net.

C#.Net code to get current date in dd/mm/yyyy format in asp.net

write the below code on button click or as per your requirement
string curr_Date = null;
curr_Date = System.DateTime.Today.ToString("dd-MMM-yyyy");
Response.Write(curr_Date);
Result will be like: 21-Feb-2013

VB.Net code to get current date in dd/mm/yyyy format in asp.net

write the below code on button click or as per your requirement
Dim curr_Date As String = Nothing
curr_Date = System.DateTime.Today.ToString("dd-MMM-yyyy")
Response.Write(curr_Date)

Result will be like : 21-Feb-2013
Introduction:   By default session timeout is 20 minutes but sometimes it is required to increase or decrease the session timeout as per application requirement. It is possible by a simple setting in the web.config file.

let's say we have to  increase session timeout to 1 hour then make changes in the web.config files as:
open your web.config file and add

 <system.web>
<sessionState timeout="60"></sessionState>
</system.web>
OR
<system.web>
 <sessionState mode="InProc" cookieless="false" timeout="60" />
</system.web>

OR
<system.web>
<sessionState
    mode="InProc"
    stateConnectionString="tcpip=127.0.0.1:42424"
    stateNetworkTimeout="60"
    sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
    cookieless="false"
    timeout="60"/>

</system.web>