Hi all,
Please help me to solve this problem..
im trying to call my web API from my plugin but its thowing this exception
{"Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
And My Code Is:
HttpWebRequest request = WebRequest.Create("http://localhost:xxxx/api/CRM") as HttpWebRequest;
request.Method = "Post";
request.KeepAlive = false;
request.Timeout = 20000;
byte[] dataByte = Encoding.ASCII.GetBytes(Json);
request.ContentLength = dataByte.Length;
request.ContentType = "application/json";
Stream dataStream = request.GetRequestStream();
dataStream.Write(dataByte, 0, dataByte.Length);
dataStream.Close();
HttpWebResponse POSTResponse = request.GetResponse() as HttpWebResponse; //Get response from server
StreamReader reader = new StreamReader(POSTResponse.GetResponseStream());
reader.Close();