i2u4ever Posted September 16, 2016 Share Posted September 16, 2016 When Setting a cookie value with a path parameter, the value cannot be read. For Example, UniApplication.Cookies.SetCookie('_test1', 'can be read', Date+7.0); UniApplication.Cookies.SetCookie('_test2', 'can not be read', Date+7.0, false, false, '/app1/app1.dll'); UniApplication.Cookies.Values['_test1']; //This can get the value UniApplication.Cookies.Values['_test2']; //This cannot get the value UniApplication.Cookies.GetCookie('_test2'); //This cannot get the value How to get a cookie value with a path parameter? I am using regular version 0.99.96.1322 Best Regards. Link to comment Share on other sites More sharing options...
zilav Posted September 16, 2016 Share Posted September 16, 2016 I just base64 encode/decode all string values in cookies unless they are numbers. Link to comment Share on other sites More sharing options...
Sherzod Posted September 16, 2016 Share Posted September 16, 2016 Hi, Try this: UniApplication.Cookies.SetCookie('_test2', 'can not be read', Date+7.0, false, false, '/app1'); Best regards Link to comment Share on other sites More sharing options...
i2u4ever Posted September 16, 2016 Author Share Posted September 16, 2016 Hi, Try this: UniApplication.Cookies.SetCookie('_test2', 'can not be read', Date+7.0, false, false, '/app1'); Best regards Thanks. I tried your code, but failed. When a path parameter exists, uniGUI's GetCookie cannot read the cookie value. Only the root path '/' is allowed to get the cookie value. When testing with "C:\Program Files\FMSoft\Framework\uniGUI\Demos\Desktop\Cookies Demo", this demo also cannot get the cookie value after Setting Cookie with a path parameter like '/App1' Please test again, and let me solve this problem. Best Regards. Link to comment Share on other sites More sharing options...
Sherzod Posted September 16, 2016 Share Posted September 16, 2016 Hi, I can not reproduce this issue.. Which browser are you using?! Can you make a small test case for this?! Best regards. Link to comment Share on other sites More sharing options...
i2u4ever Posted September 16, 2016 Author Share Posted September 16, 2016 I use Chrome and IE11. Attached demo sets cookie with a path, and get cookie. Best Regards. CookiesDemo.zip Link to comment Share on other sites More sharing options...
Sherzod Posted September 16, 2016 Share Posted September 16, 2016 UniServerModule.UrlPath -> '/App1' Link to comment Share on other sites More sharing options...
i2u4ever Posted September 18, 2016 Author Share Posted September 18, 2016 Thanks, it works. UniServerModule.UrlPath is set when design time only, and cannot be changed at runtime. Is there any other problem when UniServerModule.UrlPath is set with a some value as like '/App1'? What is the function or role of the UniServerModule.UrlPath in uniGUI Application? Best Regards. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now