i2u4ever Posted September 16, 2016 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. Quote
zilav Posted September 16, 2016 Posted September 16, 2016 I just base64 encode/decode all string values in cookies unless they are numbers. Quote
Sherzod Posted September 16, 2016 Posted September 16, 2016 Hi, Try this: UniApplication.Cookies.SetCookie('_test2', 'can not be read', Date+7.0, false, false, '/app1'); Best regards Quote
i2u4ever Posted September 16, 2016 Author 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. Quote
Sherzod Posted September 16, 2016 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. Quote
i2u4ever Posted September 16, 2016 Author Posted September 16, 2016 I use Chrome and IE11. Attached demo sets cookie with a path, and get cookie. Best Regards. CookiesDemo.zip Quote
i2u4ever Posted September 18, 2016 Author 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.