Controller / Routing Issue

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 anos atrás
Hello,

I am working on a solution which calls a view through the following line of code @Html.Action("SecProvRev", "Catalog", new { productId = Model.Id })

I have added the relevant controller method and routing action to the solution, however on load of the page, I recieve an error stating

"A public action method 'SecProvRev' was not found on controller 'Nop.Web.Controllers.CatalogController'."

Has any one ever experienced this error before or aware of a fix? Any help is appreciated.
Thank you in advance!
8 anos atrás
JessicaRaper.pja wrote:
Hello,

I am working on a solution which calls a view through the following line of code @Html.Action("SecProvRev", "Catalog", new { productId = Model.Id })

I have added the relevant controller method and routing action to the solution, however on load of the page, I recieve an error stating

"A public action method 'SecProvRev' was not found on controller 'Nop.Web.Controllers.CatalogController'."

Has any one ever experienced this error before or aware of a fix? Any help is appreciated.
Thank you in advance!


Paste here your added code. Over check pronunciation of method and signature ..... no need to write route ..it will work as child action
8 anos atrás
[NopHttpsRequirement(SslRequirement.No)]
        public ActionResult SecProvRev(int productId)
        {
            var product = _productService.GetProductById(productId);
            if (product == null || product.Deleted || !product.Published || !product.AllowCustomerReviews)
                return RedirectToRoute("HomePage");

            var model = new ProductReviewsModel();
            PrepareProductReviewsModel(model, product);
          

            if (_workContext.CurrentCustomer.IsGuest() && !_catalogSettings.AllowAnonymousUsersToReviewProduct)
                ModelState.AddModelError("", _localizationService.GetResource("Reviews.OnlyRegisteredUsersCanWriteReviews"));

            model.AddProductReview.Rating = _catalogSettings.DefaultProductRatingValue;
            return View(model);
        }

is the current code.

The problem lies when running it on a server, when running this solution locally it seems to work fine..

currently trying your suggestion, will post results.
8 anos atrás
JessicaRaper.pja wrote:
[NopHttpsRequirement(SslRequirement.No)]
        public ActionResult SecProvRev(int productId)
        {
            var product = _productService.GetProductById(productId);
            if (product == null || product.Deleted || !product.Published || !product.AllowCustomerReviews)
                return RedirectToRoute("HomePage");

            var model = new ProductReviewsModel();
            PrepareProductReviewsModel(model, product);
          

            if (_workContext.CurrentCustomer.IsGuest() && !_catalogSettings.AllowAnonymousUsersToReviewProduct)
                ModelState.AddModelError("", _localizationService.GetResource("Reviews.OnlyRegisteredUsersCanWriteReviews"));

            model.AddProductReview.Rating = _catalogSettings.DefaultProductRatingValue;
            return View(model);
        }

is the current code.

The problem lies when running it on a server, when running this solution locally it seems to work fine..

currently trying your suggestion, will post results.


For server===> clear cache and don't forget restart the iis server and application.
8 anos atrás
Upon first upload to the IIS server, the application works fine with no errors at all, its upon restart of the IIS server that I get the error I'm querying about
8 anos atrás
JessicaRaper.pja wrote:
Upon first upload to the IIS server, the application works fine with no errors at all, its upon restart of the IIS server that I get the error I'm querying about


Check is there any plugin that use Nop.Web.dll and contains it its own folder. It may replace your current Nop.Web.dll
7 anos atrás
"any plugin that use Nop.Web.dll and contains it its own folder"

What do you mean?

How to tell if my plugin is doing that?

Experiencing similar problem of routing on IIS restart. All works fine before.
7 anos atrás
robbyr wrote:
"any plugin that use Nop.Web.dll and contains it its own folder"

What do you mean?

How to tell if my plugin is doing that?

Experiencing similar problem of routing on IIS restart. All works fine before.


Yes. If you Nop.Web as reference in your plugin and then make sure from properties copy local =false.  See the image

[/url]
Taken with [url=http://www.openscreenshot.com" rel="nofollow,ugc">Open Screenshot


Note: It will by default  copy local =true. and then will create a Nop.Web.dll in you plugin folder.
7 anos atrás
sohel wrote:
[I]
Taken with Open Screenshot

Note: It will by default  copy local =true. and then will create a Nop.Web.dll in you plugin folder.


Thanks Man!

Nop.Web.dll is in my PLUGIN. In what situations a plugin would need Nop.Web.dll?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.