我在win7下面开发一个winform程序,里面放一个WebBrowser控件,将它定位到一个本地路径的网页当中,这些都没有问题。现在我想对这个网页内容做一些修改,使用  HtmlDocument main_formDoc = wbShowPage.Document; 后就报访问被拒绝,查网上有人说是ASP.NET这个账户没有加入,但是WIN7里面没有这个账户,求各个大侠给个解决方案啊。

解决方案 »

  1.   

    是不是 WIN7 下面 管理权限的问题。类似win7下好多dll文件不能注册一样~  我猜想的~
      

  2.   

    System.UnauthorizedAccessException{"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}at System.Windows.Forms.UnsafeNativeMethods.IHTMLLocation.GetHref()
       at System.Windows.Forms.WebBrowser.get_Document()
       at PickText.Form1.hd_MouseUp(Object sender, HtmlElementEventArgs e) in D:
      

  3.   

    在你窗体类声明之前,加上权限和COM的特性    [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
        [System.Runtime.InteropServices.ComVisibleAttribute(true)]
        public partial class MyWebForm: Form
        {
        }
      

  4.   

    webBrowser1.ObjectForScripting = this;
    在窗体类自身设置Attribute 
    [PermissionSet(SecurityAction.Demand, Name="FullTrust")]
    [System.Runtime.InteropServices.ComVisibleAttribute(true)]
    public class Form1 : Form
    {}