I have a strange problem on my login page in asp.net. This problem only happens with Safari.
When the user is valid, then I get the user's name from the database (the field in the database is UTF8) and saves it in a cookie. The problem is that when the user has the name of the special characters, I am redirected to the page where I came without logging in. For example, "Mowler" works fine and the user is logged in but not the "Mileer".
Then this is happening only with Safari and when there are special characters in my name the line that is not working: reaction. Cookies ["userInfo"] ["name"] = getNameFromUserid (userid);
This is my code:
string user id = legitimate user profile (textbox e-mail text, text box password.); If (userid! = Null) {// VALID user feedback. Cookies ["userInfo"]. Timeout = date time.NEW ADADEZ (30); reaction. Cookies ["user information"] ["name"] = getNameFromUserid (userid); Formatting Redirectfromline page (UIIID, checkbox, persist cookie.chip); } Else {// NOT Show a valid user user or message for some time
Safari will not set cookies in their prices with non-ASCII characters and other browsers may be unpredictable in displaying non-ASCII characters. As a semi-colon is not allowed for a browser, I recommend using the URLNcode / URLDCode.
If you are just writing a cookie and do not have control over reading / displaying on the site, you can do anything like this:
ckCookie. Value = (Server.HtmlEncode (strSpecialCharacters)) Change (";", ""); This will ensure that the full string is set in cookie and Safari, Chrome, Firefox and IE will still recognize the HTML code; Decoding does not require reading and reading.
To see a longer answer on the cookie glasses:
Comments
Post a Comment