missing a reference The referenced component 'System.Web.WebPages.Administration' could not be found.

rob m 261 Reputation points
2021-08-04T05:35:10.833+00:00

I have a reference to
System.Web.WebPages.Administration that seems to be missing see attached image. How do I reinstall it?

120334-image.png

Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

Accepted answer
  1. rob m 261 Reputation points
    2021-08-06T14:13:18.1+00:00

    Server Error in '/' Application.
    Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical method 'System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)' 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 by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical method 'System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)' 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 by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical method 'System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)' failed.]
    System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule() +44
    System.Web.WebPages.Administration.PreApplicationStartCode.Start() +22

    [InvalidOperationException: The pre-application start initialization method Start on type System.Web.WebPages.Administration.PreApplicationStartCode threw an exception with the following error message: Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical method 'System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)' failed..]
    System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection1 methods, Func1 setHostingEnvironmentCultures) +646
    System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +147
    System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +107
    System.Web.Compilation.BuildManager.ExecutePreAppStart() +165
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +590

    [HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.WebPages.Administration.PreApplicationStartCode threw an exception with the following error message: Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical method 'System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)' failed..]
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10087352
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +263

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4330.0


3 additional answers

Sort by: Most helpful
  1. Yijing Sun-MSFT 7,096 Reputation points
    2021-08-05T02:18:58.137+00:00

    Hi @rob m ,
    First you need to check if the nuget package exists.
    If you need to install it,you could do like this:
    Right click your project-->Select Manage Nuget Package-->Search 'Microsoft.AspNet.WebPages.Administration' in Browse search textbox-->Select and Install it.

    If the package exist but broken, you could uninstall and then reinstall it,there are two ways:

    • In Package Manager console,you could enter this command: Update-Package -reinstall
    • In Package Manager UI Right click your project-->Select Manage Nuget Package-->Search 'Microsoft.AspNet.WebPages.Administration' in Installed search textbox-->Select and Unstall it -->
      Search 'Microsoft.AspNet.WebPages.Administration' in Browse search textbox-->Select and Install it.

    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. rob m 261 Reputation points
    2021-08-06T14:12:35.09+00:00

    Yes I saw that posting as well , I did delete all the dll in the bin folder cleaned and re build . I still get that error

    0 comments No comments

  3. rob m 261 Reputation points
    2021-08-09T11:54:26.803+00:00

    that worked!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.