16 Oct 2017

Cookies in asp.net with example


What is Cookies in Asp .net 

Cookies is the small text file save in client browser or machine. Store the information client blower just like Name Password etc..

type of cookies:-

There are two types of cookies:-

1.Persist Cookies.
2.Non-Persist Cookies

Non-Persist Cookies:- The user fill the information in web form name age mobile etc.. this information save the 
browser memory temporary time. The browser close data is lost this type of cookies is Non Persist Cookies.




Persist Cookies :- Persist Cookies the user fill the information in web form just like  name password etc.. then this information store the small text file in the browser memory.this text file does not remove after close browser.


Example:-


   

       

           

               
                    User Name
                   
                   
               

               
                    Password
                   
                   
               

                 
                   
                   
                     
               
           
       
   


.CS page coding:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace cookes
{
    public partial class cookes1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn1_Click(object sender, EventArgs e)
        {
            Response.Cookies["Uname"].Value = TextUname.Text;
            Response.Cookies["Password"].Value = TextPassword.Text;
            Response.Cookies["uname"].Expires = DateTime.Now.AddDays(2);
            Response.Cookies["Password"].Expires = DateTime.Now.AddDays(2);
        }

        protected void btn2_Click(object sender, EventArgs e)
        {
            Lebel1.Text = Request.Cookies["Uname"].Value;
            Label2.Text = Request.Cookies["Password"].Value;
        }
    }
}
Read Complete

15 Oct 2017

what is java script language in asp.net


what is JavaScript

JavaScript is the client site scripting language it is developed by NETSCAPE in 1995. it is light-weight programming and 
open souece source scipting language.

Use of java script:- java script can be use to dynamic web page and java script use to just like validations and security
purpose 

for example:-


function validation() {

            alert('Hello Rock Programmer');

            var TN = document.getElementById('textname');
            if (TN.value == "") {
                alert('Plese enter your name!!');
                return false;
            }

Advantage of java script:- 

java script provide to immediate feedback to user. suppose that your site registration page user fill the information .just like name age address and etc.. 

if any text box fill the incorrect then show the alert error massage.

blank record will not insert in your site database.

Java scripting language run the client browser.

Read Complete

Popular Posts

Popular Posts

Translate

Total Pageviews