Sunday 26 May 2013

Validation controls,sessions and Masterpage



Validation Controls:
--------------------
Validation controls are used to perform validation on server controls at the client side without writing any code.

There are 5 validation controls:
-------------------------------
1) Required Field Validator
2) Compare
3) Range
4) Regular Expression
5) Custom
6) Validation Summary

> Validation is a process of checking the data whether it is correct or not
> Validation controls are applicable on text box controls.

1) Required Field validator:
-----------------------------
It is used to check whether the data is entered in the textbox control.

2) Compare:
------------
It is used to compare the  contents of 2 different controls 

3)Range:
----------
It is used to check whether the data  entered is within the range or not.

4) Regular Expression:
--------
It is used to check whether the data is entered is in proper format or not.

5) Custom:
-----
It is used to perform validation as per the user specific requirement
This validator is used when the existing validators are  not suitable 

Cookies:
-------
A cookie is a small text based program which stores the information on client machine this information can be accessed later on when a user visits the same website.
This information is stored on the clients browser for a temporary period.
Cookies should not be used for store confidential information like passwords.

There are 2 types of cookies:
-------------------------------
1) Session cookie:
---------------
By default the cookie values are stored only in the browser once the browser is closed the cookie values are lost.
These cookies are stored only for temporary period and are called as session cookies.

2) Persistent cookies:
------------------
persistent cookies are the cookies where the cookie values are stored on the local disk for a specific period

There are 2 methods for interacting with the cookies:
----------------------------------------------------
1) Response&request cookies(asp)
2) Http cookies(asp.net)
It is implemented using cookies collection(variables,fun,prop)
Response object cookies are used to send the cookie information from server to client Browser.
Request object cookies are used to read  the cookie information from client to server.
Button_click:
--------------

When a user clicks on the signin button a postback occurs and the click event checks the status of the checkbox.
if the checkbox is checked then a cookie is created with the value entered in the textbox and then an expiry is assigned for a period of 2 days.
If the checkbox is  unchecked then no cookie is created.
page_load:
---------

whenever the page is executed this event will fired and it checks the status of the postback,If ispostback is false(ie.the user has executed the page for the first time and the program will check the cookie in the client machine and if it exists reads the cookie into the textbox.
this will not executed when the user clicks on the button(when thepostback occurs).
Http Cookie:
-------------

It provides an object oriented approch for working with the cookies.
It consists of a class call httpcookie through which cookies are handled.

Masterpages:
-------------

Mp are used to provide common appearance to the website with respect to headers,footers and sidebars.

The mater page contents is common for the whole website.

Content pages are the actual webpages which display the information on the webpages.
Content pages keep changing.

A MP consists of a control called content place holder control which specifies region or the area where pages should be displayed.

A MP cannot be executed directly.A content page is created as part of MP.
it consists of contentControl.

ContentControl will override the contentplaceholdercontrol where the content page actually appears.

>When the content page is executed it takes the appearance part of the MP and then executes 
MP consists of .master extension.

>A MP provides an easy way  for maintaining the site,any change in the Mp will an effect on content pages.

>A website can have 1 or  more MP also.

Procedure for adding Content pages:
--------------------
1)select the masterpage
2)website-->add contentpage-->this step creates a content page and it is linked to the mp.
The content page has an attribute called Mp file which is linked to the mp.
->if any links are provided through master page they should be linked to content page only.
if they are linked to other webpages then the mp  will not exist. 

1 comment: