I am creating a application using CANJS. To display the user Information basing on the cookie I am not not knowing how to create and delete a cookie using CANJS.
can some one please help me
Go to http://javascriptmvc.com/docs.html and type cookie in the search box.
$.cookie('name','value');
var value = $.cookie('name');
Or you could use http://jquerypp.com/
may be I'm late but you can try jquery++ cookies
Related
I have the following scenario:
Server A:abpWeb;
Server B:abpWeb;
A and B are based on MyCompanyName.AbpZero template, abp. Net core version 3.1.1;aspnetboilerplate
Browser access A:abpWeb and B:abpWeb. But after logging in, cookie shared is invalid.
A:User.Identity?.IsAuthenticated equals true after Browser access A:Login;
But refresh B:/index on the browser,B:User.Identity?.IsAuthenticated equals false;
The same browser domain for A and B is the same.
I created two new ASP.NET Core 2.0 MVC apps with ASP.NET Core Identity, using AddDataProtection for the normal shared cookie is ok.
I referred to:
https://learn.microsoft.com/en-us/aspnet/core/security/cookie-sharing?tabs=aspnetcore2x
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
Thanks in advance.
The keys that encrypt/decrypt your cookies are probably trying to be written to an invalid folder.
By default AddDataProtection tries to write these keys to:
%LOCALAPPDATA%\ASP.NET\DataProtection-Keys
As long as there is an environment variable being used to create the keys path, you will need to set the following config file setting to true.
Please also see my other answer here:
IIS - AddDataProtection PersistKeysToFileSystem not creating
Fix: Within %WINDIR%\System32\inetsrv\config\applicationHost.config set setProfileEnvironment=true. I think you have to restart IIS as well.
I'm trying to use express-flash in a standard web express js app. I don't want to use session, because I want to do the app as stateless as possible, but when I try to use without session, the app show me this error:
req.flash() requires sessions
Can I use express-flash without session? Can I use other alternatives for this kind of messages?
Thanks.
Note: A flash message is a variable stored within a session that is only available once, for the next request. That is if we put a flash variable and renders a page, the flash variable is available but if we render the same (or other) page again the flash variable is not present (it is destroyed).
-- acanimal
Based on this premise, you need to have sessions to use message flashing.
One way I think you can accomplish what you want is to add an item to the request (req) object in your middleware, and then in your controller, check if the key exists. You can then pass a specific message to your template, assuming you're using a template engine or pass it as part of your response.
Hope this helps.
Hi guys I've download the latest version of joomla and I'm trying to analyze it's session but I had a problem with the session name and getsession() .
Because all the sessions name is (4109fdb14b2662cce79b856bc4d72ed3)
So my question is where did this value come from?
and one more thing ... where is getsession defined?
use
$session_name = JFactory::getSession()->getName();
Actually Joomla relies on PHP to handle the session id / session.
See also session_id().
As pointed out in comments, have a look the the JSession class.
I am tracking visitors not by the cookies but by explicitly populating the
s.visitorID variable with unique visitor IDs on all pageviews.
Now, I want to get a New vs Repeat visitors report. I am aware of the
getNewRepeat plugin which works using cookies.
Is there any Plugin for new vs repeat visitor report for tracking done by
s.visitorID? If not, how can I get the New vs Repeat visitors report in a non-cookie based setup?
Please help with the same. Thanks in advance.
The getNewRepeat plugin creates a new cookie just to track that information. It will work with cookies or a custom visitorID because it is completely seperate (another cookie). If what you mean is that you aren't able or willing to use cookies at all, you will need a different mechanism to track whether a visitorID was just set (new visitor) or was already set (returning visitor) - emulating the way the plugin would normally work.
When a user logs in for the first time, set an eVar to 'New'.
On subsequent logins, set the same eVar to 'Repeat'.
I have seen lots of posts here and elsewhere stating that one can access session variables from app_code. I want to access an already created session.
this code errors out because of a null exception.
string myFile = HttpContext.Current.Session["UploadedFile"];
this creates a null session variable.
System.Web.SessionState.HttpSessionState Session = HttpContext.Current.Session;
It looks like I can create a new session variable but not access an already created one. Anyone have any idea what might be giving me problems?
I was having ths same problem, but I was able to fix it because I controlled where in the event lifecycle I was attempting to leverage HttpContect.Current.Session... it makes a difference because Session isn't available, for example, on construction.
Maybe that will help you.