• 26-08-2010, 16:47:43
    #1
    C# ile bir program yapıyorum. Ama bir türlü Cookie olayını yapamadım. Acaba yapılmış örnek uygulamalar.. ve önerebileceğiniz yöntemler var mı ?
  • 26-08-2010, 22:28:16
    #2
    Masaüstü uygulaması için nasıl bir cookie olayı düşündüğünüzünü biraz daha detaylı anlatırsanız yardımcı olmaya çalışayım, hem diğer arkadaşlar için de detay olması iyi olur
  • 27-08-2010, 09:12:18
    #3
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Normalde win application cookie desteklemez. Eğer farklı bir amacınız varsa msdn'den aldığım kod işinize yarayabilir.

    Msdn'den bir örnek:
    [C#] 
    using System.Net;
    using System;
    namespace Examples.System.Net.Cookies
    {
        // This example is run at the command line.
        // Specify one argument: the name of the host to 
        // send the request to.
        // If the request is sucessful, the example displays the contents of the cookies
        // returned by the host.
    
        public class CookieExample
        {   
            public static void Main(string[] args)
            {   
                if (args == null || args.Length != 1)
                {
                    Console.WriteLine("Specify the URL to receive the request.");
                    Environment.Exit(1);
                }
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(args[0]);
                request.CookieContainer = new CookieContainer();
    
                HttpWebResponse response = (HttpWebResponse) request.GetResponse();
                response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
    
    
                // Print the properties of each cookie.
                foreach (Cookie cook in response.Cookies)
                {
                    Console.WriteLine("Cookie:");
                    Console.WriteLine("{0} = {1}", cook.Name, cook.Value);
                    Console.WriteLine("Domain: {0}", cook.Domain);
                    Console.WriteLine("Path: {0}", cook.Path);
                    Console.WriteLine("Port: {0}", cook.Port);
                    Console.WriteLine("Secure: {0}", cook.Secure);
    
                    Console.WriteLine("When issued: {0}", cook.TimeStamp);
                    Console.WriteLine("Expires: {0} (expired? {1})", 
                        cook.Expires, cook.Expired);
                    Console.WriteLine("Don't save: {0}", cook.Discard);    
                    Console.WriteLine("Comment: {0}", cook.Comment);
                    Console.WriteLine("Uri for comments: {0}", cook.CommentUri);
                    Console.WriteLine("Version: RFC {0}" , cook.Version == 1 ? "2109" : "2965");
    
                    // Show the string representation of the cookie.
                    Console.WriteLine ("String: {0}", cook.ToString());
                }
            }
        }
    }
  • 27-08-2010, 23:54:43
    #4
    vallaha arkadaşlar. webte cookie ile yapılıyor ama maüstünde bilmiyorum. Kullanıcı giriş yaptığnda.. Beni hatırla kısmını yapmak istiyorum nasl bir yol izlemeliyim.. şimdiden teşekkür ederim iyi geceler
  • 28-08-2010, 00:25:02
    #5
    Şu şekilde yapabilirsin.
    İlk girişte db'den gerekli kontrolleri yaptığını varsayıyorum.
    Guid UserID;
    UserID = (Guid)dtGetAccess.Rows[0]["id"];
    frmMain Main = new frmMain(UserID);
    frmMain girişten sonra gideceği form olsun.
    Orda InitializeComponent(); ile gelen değeri alabilir ve kontrol edebilirsin tekrar.

    public frmMain()
    {
         InitializeComponent();
    }
    
    public frmMain(Guid _UserID)
    {
         InitializeComponent();
         UserID = _UserID;
    }