Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. E_Accessdenied

E_Accessdenied

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpcssvisual-studiosysadminhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VahagnSC
    wrote on last edited by
    #1

    Hello all!! I have written a program in c# which use System.Windows.Forms.Webbrowser class. I do something like this: System.Windows.Forms.HtmlElementCollection refcol= webbrowser1.document.window.Frames[0].Frames[0].GetEelmentsByTagName("A"); When I load the page from apache2 on my computer it works perfectly. But when I load it from remote server an exception occurs. This is the Text of exception: ///////////////////////////////////////////////////// See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at System.Windows.Forms.UnsafeNativeMethods.IHTMLWindow2.GetDocument() at System.Windows.Forms.HtmlWindow.get_Document() at My_Web.create_elementscollection() in C:\Documents and Settings\Vahagn\My Documents\Visual Studio 2005\Projects\OGAME\OGAME\Class1.cs:line 49 at OGAME.Form1.button5_Click(Object sender, EventArgs e) in C:\Documents and Settings\Vahagn\My Documents\Visual Studio 2005\Projects\OGAME\OGAME\Form1.cs:line 53 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) and bla-bla-bla... //////////////////////////////////////////////////////////// I think the problem is in secutity level. Do you know how to grant require permissions to my application? Or, may be the problem is other.... It has to be some way to solve this problem. I am administrator and I have to be able to allow my program to do anything it wants. I'm beginner in programming, so I ask to use as less therms as you can. Thanks in advance.

    You can do everything!

    K 1 Reply Last reply
    0
    • V VahagnSC

      Hello all!! I have written a program in c# which use System.Windows.Forms.Webbrowser class. I do something like this: System.Windows.Forms.HtmlElementCollection refcol= webbrowser1.document.window.Frames[0].Frames[0].GetEelmentsByTagName("A"); When I load the page from apache2 on my computer it works perfectly. But when I load it from remote server an exception occurs. This is the Text of exception: ///////////////////////////////////////////////////// See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at System.Windows.Forms.UnsafeNativeMethods.IHTMLWindow2.GetDocument() at System.Windows.Forms.HtmlWindow.get_Document() at My_Web.create_elementscollection() in C:\Documents and Settings\Vahagn\My Documents\Visual Studio 2005\Projects\OGAME\OGAME\Class1.cs:line 49 at OGAME.Form1.button5_Click(Object sender, EventArgs e) in C:\Documents and Settings\Vahagn\My Documents\Visual Studio 2005\Projects\OGAME\OGAME\Form1.cs:line 53 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) and bla-bla-bla... //////////////////////////////////////////////////////////// I think the problem is in secutity level. Do you know how to grant require permissions to my application? Or, may be the problem is other.... It has to be some way to solve this problem. I am administrator and I have to be able to allow my program to do anything it wants. I'm beginner in programming, so I ask to use as less therms as you can. Thanks in advance.

      You can do everything!

      K Offline
      K Offline
      karle
      wrote on last edited by
      #2

      You have to adjust code access security settings. .NET checks where your application is started and assigns a codegroup. Local executables have "full trust" by default. If you start your app from a UNC path it is in intranet zone. If you start it from a IP Adress it is in internet zone. By default intranet und internet zone have serveral restrictions. try this: Open a command prompt and type: caspol -rsg you can see the codegroups your assembly belongs to. caspol -rsp will show you which permissions are granted to your application. If you have the .NET Framework SDK on the machine you can use the .NET configuration tool. If you want your application to have always fulltrust you can do this: a) sign your assemblies with a strong name and add a codegroup with a strong name condition (you can use caspol) b) sign your assemblies with a certificate and add a codegroup with a publisher condition (you can use caspol)

      V 1 Reply Last reply
      0
      • K karle

        You have to adjust code access security settings. .NET checks where your application is started and assigns a codegroup. Local executables have "full trust" by default. If you start your app from a UNC path it is in intranet zone. If you start it from a IP Adress it is in internet zone. By default intranet und internet zone have serveral restrictions. try this: Open a command prompt and type: caspol -rsg you can see the codegroups your assembly belongs to. caspol -rsp will show you which permissions are granted to your application. If you have the .NET Framework SDK on the machine you can use the .NET configuration tool. If you want your application to have always fulltrust you can do this: a) sign your assemblies with a strong name and add a codegroup with a strong name condition (you can use caspol) b) sign your assemblies with a certificate and add a codegroup with a publisher condition (you can use caspol)

        V Offline
        V Offline
        VahagnSC
        wrote on last edited by
        #3

        It doesn't help. The same problem appears again. When I run program in debug mode (by pressing F5) debbuger says that exception throws from mscorlib.dll. May be this will help you to help me?

        K 1 Reply Last reply
        0
        • V VahagnSC

          It doesn't help. The same problem appears again. When I run program in debug mode (by pressing F5) debbuger says that exception throws from mscorlib.dll. May be this will help you to help me?

          K Offline
          K Offline
          karle
          wrote on last edited by
          #4

          the caspol.exe is part of the sdk ! See <%windows%>\Microsoft.NET\Framework\v2.0.50727 Please try this !

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups