views:

209

answers:

1

CA2122: Do not indirectly expose methods with link demands.

My code is as follows:

public void LoadPage(Uri url)

    {

        webBrowser1.Url = url;    //webBrowser1 is an object of WebBrowser

        webBrowser1.Refresh();

    }

Fxcop produced the warning "CA2122: Do not indirectly expose methods with link demands."

  1. Why this warning appeared on my code?

  2. How to fix it?

  3. How can I grant permission to my code to fullfill Code access security (CAS) attribute. i.e I have an attribute on a method like this [EnvironmentPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = false)]

What permission I have give my code and How for above mentioned attribute?

Thanks

Mansoor Mehmood