Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 498
  • Last Modified:

Compile Error

I have created a class file that give me the following error:
Error      1      'MyIsysTest.HttpRuntime.HttpRuntime()' must declare a body because it is not marked abstract, extern, or partial.
The error is about this line:
public HttpRuntime();

I am not sure what is missing here.
using System;
using System.Configuration;
using System.Data.Common;
using System.Security;
using System.Web.Caching;
using System.Web.Compilation;
using System.Xml;
using System.Web;
 
namespace MyIsysTest
{
    public sealed class HttpRuntime
    {
        public HttpRuntime();
 
        // Summary:
        //     Gets the application identification of the application domain where the System.Web.HttpRuntime
        //     exists.
        //
        // Returns:
        //     The application identification of the application domain where the System.Web.HttpRuntime
        //     exists.
        public static string AppDomainAppId { get; private set; }
        //
        // Summary:
        //     Gets the physical drive path of the application directory for the application
        //     hosted in the current application domain.
        //
        // Returns:
        //     The physical drive path of the application directory for the application
        //     hosted in the current application domain.
        public static string AppDomainAppPath { get; private set; }
        //
        // Summary:
        //     Gets the virtual path of the directory that contains the application hosted
        //     in the current application domain.
        //
        // Returns:
        //     The virtual path of the directory that contains the application hosted in
        //     the current application domain.
        public static string AppDomainAppVirtualPath { get; private set; }
        //
        // Summary:
        //     Gets the application identification of the application domain where the System.Web.HttpRuntime
        //     exists.
        //
        // Returns:
        //     The unique application domain identifier.
        public static string AppDomainId { get; private set; }
        //
        // Summary:
        //     Gets the folder path for the ASP.NET client script files.
        //
        // Returns:
        //     The folder path for the ASP.NET client script files.
        //
        // Exceptions:
        //   System.Web.HttpException:
        //     ASP.NET is not installed.
        public static string AspClientScriptPhysicalPath { get; private set; }
        //
        // Summary:
        //     Gets the virtual path for the ASP.NET client script files.
        //
        // Returns:
        //     The virtual path for the ASP.NET client script files.
        public static string AspClientScriptVirtualPath { get; private set; }
        //
        // Summary:
        //     Gets the physical path of the directory where the ASP.NET executable files
        //     are installed.
        //
        // Returns:
        //     The physical path to the ASP.NET executable files.
        //
        // Exceptions:
        //   System.Web.HttpException:
        //     ASP.NET is not installed on this computer.
        public static string AspInstallDirectory { get; private set; }
        //
        // Summary:
        //     Gets the physical path to the /bin directory for the current application.
        //
        // Returns:
        //     The path to the current application's /bin directory.
        public static string BinDirectory { get; private set; }
        //
        // Summary:
        //     Gets the System.Web.Caching.Cache for the current application.
        //
        // Returns:
        //     The current System.Web.Caching.Cache.
        //
        // Exceptions:
        //   System.Web.HttpException:
        //     ASP.NET is not installed.
        public static Cache Cache { get; private set; }
        //
        // Summary:
        //     Gets the physical path to the directory where the common language runtime
        //     executable files are installed.
        //
        // Returns:
        //     The physical path to the common language runtime executable files.
        public static string ClrInstallDirectory { get; private set; }
        //
        // Summary:
        //     Gets the physical path to the directory where ASP.NET stores temporary files
        //     (generated sources, compiled assemblies, and so on) for the current application.
        //
        // Returns:
        //     The physical path to the application's temporary file storage directory.
        public static string CodegenDir { get; private set; }
        //
        // Summary:
        //     Gets a value that indicates whether the application is mapped to a universal
        //     naming convention (UNC) share.
        //
        // Returns:
        //     true if the application is mapped to a UNC share; otherwise, false.
        public static bool IsOnUNCShare { get; private set; }
        //
        // Summary:
        //     Gets the physical path to the directory where the Machine.config file for
        //     the current application is located.
        //
        // Returns:
        //     The physical path to the Machine.config file for the current application.
        public static string MachineConfigurationDirectory { get; private set; }
 
        // Summary:
        //     Removes all items from the cache.
        public static void Close();
        //
        // Summary:
        //     Returns the set of permissions associated with code groups.
        //
        // Returns:
        //     A System.Security.NamedPermissionSet object containing the names and descriptions
        //     of permissions, or null if none exists.
        public static NamedPermissionSet GetNamedPermissionSet();
        //
        // Summary:
        //     Drives all ASP.NET Web processing execution.
        //
        // Parameters:
        //   wr:
        //     An System.Web.HttpWorkerRequest for the current application.
        //
        // Exceptions:
        //   System.ArgumentNullException:
        //     The wr parameter is null.
        public static void ProcessRequest(HttpWorkerRequest wr);
        //
        // Summary:
        //     Terminates the current application. The application restarts the next time
        //     a request is received for it.
        public static void UnloadAppDomain();
    }
}

Open in new window

0
MoniMatthews
Asked:
MoniMatthews
1 Solution
 
MichaelVlasovCommented:
You must implement a body for constructor (and for all methods):

public HttpRuntime()
{
  // some initialization code here
}

As I see in your sample, you missing body for all methods (not only constructor).
0
 
TechTiger007Commented:
if you are planning to declare the methods are abstract then you have to declare them abstract other wise provide a body for the methods

public HttpRuntime();
should be changed to
public HttpRuntime()
{
}

do the same for other methods also


0
 
MoniMatthewsAuthor Commented:
Thank you for this fix.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now