Answered by:
Getting & Sending data via URL Windows Phone App.

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
-
I would create a php rest service which requires a post instead of browsing a URL to create a user
http://www.9lessons.info/2012/05/create-restful-services-api-in-php.html
- Edited by Ken Tucker Sunday, April 12, 2015 3:04 PM fixed typo
- Proposed as answer by Franklin ChenMicrosoft employee, Moderator Wednesday, April 22, 2015 1:00 PM
- Marked as answer by Jamles HezModerator Thursday, April 23, 2015 1:38 AM
Sunday, April 12, 2015 2:19 PM
All replies
-
I would probably have the app post the data to the web service instead of doing a get to create a user accountSunday, April 12, 2015 12:51 PM
-
I would probably have the app post the data to the web service instead of doing a get to create a user account
I didn't catch that, can you be more clear?Sunday, April 12, 2015 12:59 PM -
I would create a php rest service which requires a post instead of browsing a URL to create a user
http://www.9lessons.info/2012/05/create-restful-services-api-in-php.html
- Edited by Ken Tucker Sunday, April 12, 2015 3:04 PM fixed typo
- Proposed as answer by Franklin ChenMicrosoft employee, Moderator Wednesday, April 22, 2015 1:00 PM
- Marked as answer by Jamles HezModerator Thursday, April 23, 2015 1:38 AM
Sunday, April 12, 2015 2:19 PM