|
-
Aug 9th, 2007, 04:31 PM
#1
Thread Starter
Member
[Resolved] Application not using switch for returned string from server
Alright, I have a program communicating with my server to login. The server sends back a success or failure code. The application gets the code, but doesn't use the switch/case I have set up in order to proceed.
Code:
string returnString = WebConnection.SendPostData("http://site.com/login.php", "username=" + strUsername + "&password=" + strPassword);
//MessageBox.Show(returnString);
switch (returnString)
{
case "1":
{
//Login success
MessageBox.Show("Login successful.");
//Insert Login code here
break;
}
case "2":
{
//Login failure
MessageBox.Show("Login failed.");
Application.Exit();
break;
}
}
If I enable the messagebox to display returnString, it properly shows me either 1 or 2, which it gets from the server. However, from there it doesn't display either of the messageboxes which show success or failure or execute the code it should be using. If I set one of the cases to default, it takes that regardless of the server's response. Is there something I'm missing with the way I'm using case to compare a string?
Last edited by Tural; Aug 9th, 2007 at 06:01 PM.
Reason: Resolved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|