Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setCookie(c_name,value,exdays)
- {
- var exdate=new Date();
- exdate.setDate(exdate.getDate() + exdays);
- var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
- document.cookie = c_name + "=" + c_value;
- }
- var loginval = slmgusername=swetha.p + slmguserpassword = 12345678;
- setCookie("slmgusercredentails", loginval, 100);
- HttpContext.Request.Cookies["slmgusercredentials"].Values = {slmgusername%253Dswetha.p%2526slmguserpassword%253D12345678}
- UserName = HttpContext.Request.Cookies["slmgusercredentials"].Values["slmgusername"].
- function ReadCookie()
- {
- var allcookies = document.cookie;
- alert("All Cookies : " + allcookies );
- // Get all the cookies pairs in an array
- cookiearray = allcookies.split(';');
- // Now take key value pair out of this array
- for(var i=0; i<cookiearray.length; i++){
- name = cookiearray[i].split('=')[0];
- value = cookiearray[i].split('=')[1];
- alert("Key is : " + name + " and Value is : " + value);
- }
- }
- function readKeyValuesFromCookie(){
- return document.cookie
- .split( ';' )
- .map( pair => pair.split( '=' ) )
- .filter( pair => pair.length == 2 )
- .map( pair => [ pair[0].trim(), pair[1].trim() ] )
- .filter( pair => pair[0] != 'expires' )
- ;
- }
Add Comment
Please, Sign In to add comment