locked
Getting & Sending data via URL Windows Phone App. RRS feed

  • Question

  • Hi! 

    I want to communicate with my MySql database and  I'm using this code :

    public void Button_Click(object sender, RoutedEventArgs e)
            {
                var webClient = new WebClient();
                webClient.OpenReadAsync(new Uri("http://mywebsite.com/register.php?user=" + username.Text + "&password=" + password.Text + "&email=" + email.Text));
                webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(uploadScore_OpenReadComplete);
         
    
            }
    
           
    
            void register_OpenReadComplete(object sender, OpenReadCompletedEventArgs e)
            {
                try
                {
                    using (var reader = new StreamReader(e.Result))
                    {
                        string response = reader.ReadToEnd();
                        if (response == "done")
                        {
                             MessageBox.Show("You have succesful registered!", "Congratilations!", MessageBoxButton.OK);
                             
                        }
                        else if (response == "taken") 
                        {
                            MessageBox.Show("Username is already taken, please choose another one!", "Oups!", MessageBoxButton.OK);
                            
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Failed to create an account! Please check you data connection and try again!");
                    
                }
            }
    

    Is this way safe? I'm asking if someone can get and stole those informations from the URL.

    If so, how can i do communicate in another way? Or how can i protect that data ?

    Thank's :)

    Sunday, April 12, 2015 10:53 AM

Answers

All replies