Stupid Error

Last post 08-06-2007 5:37 PM by ssabw. 5 replies.

Sort Posts:

  • Stupid Error

    12-02-2006, 12:09 AM
    • Member
      10 point Member
    • Dolphin07
    • Member since 11-30-2006, 12:21 AM
    • Posts 2

    I keep running into this error when ever i try and do anything with the new AJAX stuff:

    Attempt to access the method failed.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.MethodAccessException: Attempt to access the method failed.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [MethodAccessException: Attempt to access the method failed.]
    System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags) +0
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +212
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
    System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +17
    Microsoft.Web.Handlers.ScriptResourceHandler.EncryptString(String s) +185
    Microsoft.Web.Handlers.RuntimeScriptResourceHandler.Microsoft.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip) +689
    Microsoft.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +359
    Microsoft.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +267
    Microsoft.Web.UI.ScriptManager.RegisterScripts() +649
    Microsoft.Web.UI.ScriptManager.OnPreRender(EventArgs e) +216
    System.Web.UI.Control.PreRenderRecursiveInternal() +77
    System.Web.UI.Control.PreRenderRecursiveInternal() +161
    System.Web.UI.Control.PreRenderRecursiveInternal() +161
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
     Its really annoyingAngry! Can anyone help? Thanks in advance!
  • Re: Stupid Error

    12-02-2006, 4:56 AM
    • Member
      535 point Member
    • GQAdonis
    • Member since 02-02-2006, 7:28 PM
    • Dallas, TX
    • Posts 110
    Are you in a full trust scenario on your server?  Is the Microsoft ASP.NET Ajax assembly installed in your GAC, and it that version the right version?  Is there a version of the assembly in your "bin" folder?  If so, is it the same version as the version in your GAC?  Is your application set for "medium" trust?  Is this app being run from IIS or from the Web Development Server (Cassini variant) with Visual Studio 2005?
  • Confused [*-)] Re: Stupid Error - System.MethodAccessException: Attempt to access the method failed

    01-31-2007, 11:16 PM
    • Member
      2 point Member
    • LNG210
    • Member since 02-01-2007, 3:19 AM
    • Posts 1

    I'm glad to see I'm not the only one getting this error.  I am using the latest version of AJAX, ASP.NET AJAX 1.0v, with Visual Studion 2005.  I do not have any problems while I am under my development machine.  I get the error after I publish the web site.  I am using 1and1.com as my host and I do not know what the trust level is with them.  I will have to look into that.  Once the web site is published, the error only occurs with pages that have the Script Manager added to it.  Pages that are not "AJAX" enabled do not experience any problems

     I thought there may be a conflict between the reference I had to the system.web.extensions.dll and the system.web.extensions.dll that I have in the "bin" folder of the site.  I removed the reference and ran the site under the development machine and had no problems.  I published it and again had the same error message.

     At this point I thought I would try some proven code.  I created a striped down web site that contained one page with the following code from http://ajax.asp.net/docs/mref/T_System_Web_UI_ScriptManager.aspx.  The code can be found towards the bottom of the page under Examples titled Enabling Partial-Page Updates.

     <%@ Page Language="VB" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
        Sub DropDownSelection_Change(ByVal Sender As Object, ByVal E As EventArgs)
            Calendar1.DayStyle.BackColor = _
            System.Drawing.Color.FromName(ColorList.SelectedItem.Value)
        End Sub

        Protected Sub Calendar1_SelectionChanged(ByVal Sender As Object, ByVal E As EventArgs)
            SelectedDate.Text = Calendar1.SelectedDate.ToString()
        End Sub

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>UpdatePanel Example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <asp:ScriptManager ID="ScriptManager1"
                                   runat="server" />
                <asp:UpdatePanel ID="UpdatePanel1"
                                 runat="server">
                    <ContentTemplate>
                        <asp:Calendar ID="Calendar1"
                                      ShowTitle="True"
                                      OnSelectionChanged="Calendar1_SelectionChanged"
                                      runat="server" />
                        <div>
                            Background:
                            <br />
                            <asp:DropDownList ID="ColorList"
                                              AutoPostBack="True"
                                              OnSelectedIndexChanged="DropDownSelection_Change"
                                              runat="server">
                                <asp:ListItem Selected="True" Value="White">
                                White </asp:ListItem>
                                <asp:ListItem Value="Silver">
                                Silver </asp:ListItem>
                                <asp:ListItem Value="DarkGray">
                                Dark Gray </asp:ListItem>
                                <asp:ListItem Value="Khaki">
                                Khaki </asp:ListItem>
                                <asp:ListItem Value="DarkKhaki"> D
                                ark Khaki </asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <br />
                        Selected date:
                        <asp:Label ID="SelectedDate"
                                   runat="server">None.</asp:Label>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <br />
            </div>
        </form>
    </body>
    </html>

    Under the development machine the code runs as expected.  Once published, again, I get the same error.  I agree this is a very frustrating problem and would like to know where you are getting the error, under development or after being published?  If  after being published, who are you using for your host?

     

    Thanks for any help anyone may be able to give.

  • Re: Stupid Error - System.MethodAccessException: Attempt to access the method failed

    05-23-2007, 10:35 AM
    • Member
      198 point Member
    • swaino
    • Member since 10-10-2006, 3:58 PM
    • Posts 535

    I am having exactly the same error using 1and1 supposedly "the world's best web hosts!".

    I've raised a support issue but considering the time its taken them to respond I suspect they have a problem with AJAX (despite them saying they support it).

    Why the world's number one web hosting company can't handle a major technology is beyond me?!?

    So I'm not sure what to do.  I've already spent valuable time trying to use AJAX components as part of my development work.  Either I start backwards-engineering my site to not use AJAX components just so my hosting company servers won't throw errors at me (what a shame!) or switch to a different hosting company.

    Any ideas?
     


     

  • Re: Stupid Error - System.MethodAccessException: Attempt to access the method failed

    05-23-2007, 2:51 PM
    • Participant
      1,862 point Participant
    • WishStar99
    • Member since 08-05-2006, 12:11 AM
    • VietNam
    • Posts 552

    As i remember, 1and1 do not have AJAX installed. AND you cannot put the DDLs in the BIN folder either, because that requires full permission ... don't even bother to ask them to set  your bin to full trust, because that's not possible.

    Since this issue has been arisen so often, why don' t you (people who use 1and1  as hosting provider) all bug them about this AJAX issue? Remember, 1and1  is a company from UK, they might not know what AJAX means. You need to say "ASP.NET AJAX", but they might know what "ATLAS" is. How dumb. Keep bugging them and they will eventually install it ... =)

    AND THERE IS NOTHING WRONG WITH YOUR WEB APP AND AJAX, ...  

     

    //---------------------------------------------//
    //------------------- ChloƩ ------------------//
    //---------------------------------------------//
  • Re: Stupid Error

    08-06-2007, 5:37 PM
    • Member
      12 point Member
    • ssabw
    • Member since 05-14-2007, 6:03 PM
    • Posts 6

    Hi,

    This error is really stupid. The solution is change in Web.config

    <system.web>

    <trust level="Full"/>

    </system.web>

    Read more here: http://www.onlinecrackerbarrel.com/wiki/MSAJAXTOOLKIT 

    Good Luck;

    ssabw

Page 1 of 1 (6 items)