Strange cookie problem in Safari and Asp.net

I have a strange problem on my Asp.net login page, this problem only occurs with Safari.

When the user is verified, I select the username from the database (the field in the database is UTF8) and stores it in a cookie. The problem is that when the user has a name with special characters, I get redirected to the page where I came from without being registered. For example, the “Moller” works fine, and the user is logged in, but not the “Møller".

Again this only happens with Safari and when I have special characters in the name. String that does not work: Response.Cookies ["userInfo"] ["name"] = getNameFromUserid (userid);

This is my code:

string userid = validUserWithEmail(TextBoxEmail.Text, TextBoxPassword.Text);
if (userid != null) {
    //VALID USER
    Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(30);
    Response.Cookies["userInfo"]["name"] = getNameFromUserid(userid);

    FormsAuthentication.RedirectFromLoginPage(userid, CheckBoxPersistCookie.Checked);
} 
else
{
    //NOT A VALID USER SHOW A MESSAGE FOR THE USER OR SOMETHING
}
+5
1

Safari cookie -ASCII- , , , ASCII. cookie , UrlEncode/UrlDecode.

cookie , / , URLDecode, - :

ckCookie.Value = (Server.HtmlEncode( strSpecialCharacters )).Replace(";","");

, cookie ​​ , Safari, Chrome, Firefox IE - html ; .

cookie .: cookie

+6

All Articles