Im assuming this is happening because of the sandbox. However, Im a little lost.
It works locally (in the IDE), the url is correct, the logic is correct etc. The server returns a response, locally I get a response. The json parser works correctly. It also works if I build to a Windows EXE. However, in a webplayer - it does not work (im guessing there is some security setting im missing or something).
A crossdomain policy exists on the localhost server.
I am using the webplayer locally, Ive even tried publishing to the same server as the requests are going to.
Example: http://localhost:85/gamemaster <<serves my requests
Example: http://localhost:85/logintest <<has the webplayer with the app
Here is my code.
Im not sure why it freezes and crashes the browser.
public bool Login(string email,string password){
errorMessage="";
string reqUrl=baseUrl+"index.php?r=user/login";
reqUrl+="&email="+email;
reqUrl+="&password="+password;
//WWWForm form=new WWWForm();
//form.AddField ("email",email);
//form.AddField ("password",password);
WWW www=new WWW(reqUrl);
while (!www.isDone){ LoginCor (www); } //wait for data to load
//done
Debug.Log ("done");
if (www.error==null){
//todo: move this to the proper code block after success has been tested
//user=User.CreateInstance<User>();
//user.email=email;
string jsonString=www.text;
Dictionary<string,object> dict = Json.Deserialize(jsonString) as Dictionary<string,object>;
if ((bool)dict["error"]){
errorMessage=dict["message"].ToString();
}else{
return true;
}
}else{
Debug.Log (www.error);
www.Dispose();
}
return false;
}
IEnumerator LoginCor(WWW www){
yield return www;
}
I would appreciate any insight. Thank you ![]()