Note that there are some explanatory texts on larger screens.

plurals
  1. POInheritance security rules violated while overriding member in Silverlight
    text
    copied!<p>I am working on a web application in silverlight. I have overloaded the WebClient.GetWebRequest method as given below:- </p> <pre><code>public class WebClientWithCookies : WebClient { [SecurityCritical] protected override WebRequest GetWebRequest(Uri address) { string cookieContent = HtmlPage.Document.Cookies; WebRequest request = base.GetWebRequest(address); HttpWebRequest webRequest = request as HttpWebRequest; if (webRequest != null &amp;&amp; cookieContent != null &amp;&amp; cookieContent != string.Empty) { CookieContainer cookieContainer = new CookieContainer(); cookieContainer.Add(address, new Cookie() { Value = HtmlPage.Document.Cookies }); webRequest.CookieContainer = cookieContainer; } return request; } } </code></pre> <p>But I am getting the following exception:</p> <blockquote> <p>System.TypeInitializationException was unhandled by user code<br> Message=The type initializer for 'SigmaWC.Utility.RestCommunicator' threw an exception. TypeName=SigmaWC.Utility.RestCommunicator<br> StackTrace: at SigmaWC.Utility.RestCommunicator..ctor() at SigmaWC.App..ctor() InnerException: System.TypeLoadException Message=Inheritance security rules violated while overriding member: 'SigmaWC.Utility.WebClientWithCookies..ctor()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. StackTrace: at SigmaWC.Utility.RestCommunicator..cctor() InnerException:</p> </blockquote> <p>Can anyone help in how to elevate the security settings in silverlight. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload