Godaddy-System.Security.SecurityException: You cannot use in partial trust without a policy that allows connecting to API endpoints.
I am using hosting from GoDaddy.com and yesterday got exception playing with Twitter API library – TweetSharp .
System.Security.SecurityException: You cannot use TweetSharp in partial trust without a policy that allows connecting to API endpoints.
Exception Details: System.Security.SecurityException: You cannot use TweetSharp in partial trust without a policy that allows connecting to API endpoints.
The following policy information (or equivalent) must be added to your trust policy:
<IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1">
<ConnectAccess>
<URI uri="http://twitter\.com/.*"/>
<URI uri="http://api.twitter\.com/.*"/>
<URI uri="http://search.twitter\.com/.*"/>
</ConnectAccess>
</IPermission>
After searching I found that GoDaddy will not allow me to modify their policy, since it is shared hosting account. Resolution is to apply WebPermissions in your code: