joecool2005 Posted December 7, 2012 Share Posted December 7, 2012 Hi, In global.asa when I create a cookie with HttpOnly like this Response.Cookies("mycookie")("x") = "abc";Response.Cookies("mycookie").Path ="/; HttpOnly") it displayed me this path=/%3B%20HttpOnly How can I fix this in global.asa? ThxJoe Link to comment Share on other sites More sharing options...
justsomeguy Posted December 7, 2012 Share Posted December 7, 2012 You send the cookie header manually: Response.AddHeader "Set-Cookie", "YourCookieName=YourCookieValue; path=/; HttpOnly" Link to comment Share on other sites More sharing options...
joecool2005 Posted December 7, 2012 Author Share Posted December 7, 2012 Is it possible to add value into cookie dynamically in global.asa?I want to set the cookie before the application start. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 7, 2012 Share Posted December 7, 2012 The value is part of the header. Make sure to URL-encode the value part. Link to comment Share on other sites More sharing options...
joecool2005 Posted December 7, 2012 Author Share Posted December 7, 2012 After the cookie is set in global.asa, I added this in asp file<meta http-equiv="content-type" content="text/html; charset=UTF-8">and it still showed me path=/%3B%20HttpOnly Link to comment Share on other sites More sharing options...
justsomeguy Posted December 7, 2012 Share Posted December 7, 2012 I'm not sure what the content-type tag has to do with this. Just to be clear, if you need to set additional properties on the cookie you can not use response.cookies, you have to send the cookie header manually. ASP will encode everything automatically and mess it up if you use response.cookies. You need to send the header yourself and make sure you encode the correct parts that need to be encoded. The name and value need to be encoded if they contain non-alphanumeric characters. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now