Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

"Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

$
0
0

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();


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>