1. #1
    Ext User
    Join Date
    Jul 2007
    Posts
    41
    Vote Rating
    0
    babsevensix is on a distinguished road

      0  

    Default Can i read cookie?

    Can i read cookie?


    I want to get a cookie value... is possible?
    Thanks a lot

  2. #2
    Ext User
    Join Date
    Jul 2007
    Posts
    5
    Vote Rating
    0
    technetium is on a distinguished road

      0  

    Default


    just only if it was you who set the cookie, you can't read the client's cooky that was set by someone else (i.e. ebay.com).

  3. #3
    Ext User matjaz's Avatar
    Join Date
    Apr 2007
    Location
    Slovenia
    Posts
    126
    Vote Rating
    0
    matjaz is on a distinguished road

      0  

    Default


    You'll find it in CookieProvider.

  4. #4
    Ext User
    Join Date
    Jul 2007
    Posts
    41
    Vote Rating
    0
    babsevensix is on a distinguished road

      0  

    Default


    I try this:

    Code:
        var cp = new Ext.state.CookieProvider();
        
        var userId = cp.get('bbuserid', '-1');
    but userId is always -1...

  5. #5
    Ext User
    Join Date
    Jul 2007
    Posts
    41
    Vote Rating
    0
    babsevensix is on a distinguished road

      0  

    Default


    The cookie was set by this asp.net code :
    Code:
    Dim idUser As String
    If Request.Cookies("bbuserid") IsNot Nothing Then
    idUser = Request.Cookies("bbuserid").Value
    Else
    idUser = Request.QueryString("bbuserid") If idUser IsNot Nothing AndAlso idUser.Trim.Length > 0 Then
    Response.Cookies.Add(New HttpCookie("bbuserid", idUser))
    End If
    End If
    The next time I pass this code, I can read the cookie correctly, and it give me the correct value.
    But, if I read the same cookie with CookieProvider, it give me nothing.
    The Asp.Net and JavaScript code is in the same web server and in the same directory application.

  6. #6
    Ext User matjaz's Avatar
    Join Date
    Apr 2007
    Location
    Slovenia
    Posts
    126
    Vote Rating
    0
    matjaz is on a distinguished road

      0  

    Default


    Sorry if I miss lead you. CookieProvider isn't intended for setting/getting cookies - it's for storing state in cookies. But it has functionality of reading/writing cookies so you can take a look at the source.

    Values are stored with "ys-" prefix...

  7. #7
    Ext User
    Join Date
    Jul 2007
    Posts
    41
    Vote Rating
    0
    babsevensix is on a distinguished road

      0  

    Default


    Thanks for reply, but the problem is that I want read a cookie from extjs ... Because I've set in this cookie, the iduser. The id user was set by a .Net application. This is the problem...

  8. #8
    Ext User
    Join Date
    Jul 2007
    Posts
    41
    Vote Rating
    0
    babsevensix is on a distinguished road

      0  

    Default


    I solve the problem with this 3 function:

    Code:
    function createCookie(name,value,days) {
    	if (days) {
    		var date = new Date();
    		date.setTime(date.getTime()+(days*24*60*60*1000));
    		var expires = "; expires="+date.toGMTString();
    	}
    	else var expires = "";
    	document.cookie = name+"="+value+expires+"; path=/";
    }
    
    function readCookie(name) {
    	var nameEQ = name + "=";
    	var ca = document.cookie.split(';');
    	for(var i=0;i < ca.length;i++) {
    		var c = ca[i];
    		while (c.charAt(0)==' ') c = c.substring(1,c.length);
    		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    	}
    	return null;
    }
    
    function eraseCookie(name) {
    	createCookie(name,"",-1);
    }
    Thanks a lot

    BabSevenSix

  9. #9
    Ext User
    Join Date
    Jan 2010
    Posts
    4
    Vote Rating
    0
    utpal_brsh is on a distinguished road

      0  

    Default Cookies in EXTJS

    Cookies in EXTJS


    First u set your value using a key...then fetch the value in any page using that Key...
    For setting cookies
    new Ext.util.Cookies.set("loginUser", 'utpal');
    Here loginUser is the key and 'utpal' is the value.
    now in any page where you need this value use
    Ext.util.Cookies.get("loginUser");

    If someone find any more good way then please write in this forum.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar