السلام عليكم ورحمة الله وبركاته
اريد ان اكمل هذا الكود لانة يطلع لية خطأ مش قادر اعرف الخطأ فين
بعد ازنكم
public class Utility
{
public void CreateCookie(string CookieName,string[]Keys,string[]Values,bool Expired)
{
HttpCookie c = new HttpCookie(CookieName);
if (Keys!= null)
{
for (int x = 0; x < Keys.Length; x++)
c.Values.Add(Keys[x], Values[x]);
if (!Expired)
c.Expires = DateTime.Now.AddYears(5);
}else
c.Expires = DateTime.Now.AddYears(-5);
res.Cookies.Add(c);
}
public string ReadFromCookie(string CookieName, String Key, HttpRequest req)
{
try
{
return req.Cookies[CookieName][Kye].ToString();
}
catch
{
return null;
}
}
public void RemoveCookie(string CookieName, HttpResponse res)
{
CreateCookie(CookieName, null, null , false , res );
}
}شكرا لكم جميعا