Problems with references and MVC

Asked

Viewed 117 times

0

I have a project where it works. I needed to create another project in another place and I took advantage of what I already have. It turns out you’re making a mistake on the basis.Initialize(...) saying you don’t recognize this guy. I put the same using of the other project, ie Ctrl+c and Ctrl+v and nothing else. Below my methods

protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {

            requestContext.HttpContext.Response.Buffer = true;
            requestContext.HttpContext.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
            requestContext.HttpContext.Response.Expires = 0;
            requestContext.HttpContext.Response.CacheControl = "no-cache";
            requestContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            string strPaginaAtual = requestContext.HttpContext.Request.CurrentExecutionFilePath;
            strPaginaAtual = strPaginaAtual.Remove(0, strPaginaAtual.LastIndexOf("/") + 1);

            base.Initialize(requestContext);

        }

        protected override void OnException(ExceptionContext filterContext)
        {

            base.OnException(filterContext);
        }

and my usings:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;

I went to compile and made that mistake:

Error   1   'V99Util.WebPageBase.Initialize(System.Web.Routing.RequestContext)': no suitable method found to override
  • What is the base class of the class WebPageBase?

  • @pnet, the place to publish the problem solution is in an Answer and not within the Question. Apparently, it’s the same solution that Gypsy posted, maybe mark his answer as correct?

1 answer

2

The message no suitable method found to override indicates that in the ancestral class there is no method Initialize whatever virtual with the arguments used in the child class method.

In this case, your class needs to be implemented with the following statement:

public abstract class WebPageBase : System.Web.Mvc.Controller
  • 3

    Pnet expert. ;)

  • 2

    Soon they will create the tag.

  • 2

    And automatic acceptance for tag.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.