0
votes

I'm write sitemap.config.

        <siteMapNode title="Shipping rate" nopResource="Admin.Configuration.Shipping.Rate" controller="Shipping" action="ConfigureProvider?systemName=Shipping.ByWeight"   />           


      </siteMapNode>

This is the shipping controller function which I want to call.

public ActionResult ConfigureProvider(string systemName)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
                return AccessDeniedView();

            var srcm = _shippingService.LoadShippingRateComputationMethodBySystemName(systemName);
            if (srcm == null)
                //No shipping rate computation method found with the specified id
                return RedirectToAction("Providers");

            var model = srcm.ToModel();
            string actionName, controllerName;
            RouteValueDictionary routeValues;
            srcm.GetConfigurationRoute(out actionName, out controllerName, out routeValues);
            model.ConfigurationActionName = actionName;
            model.ConfigurationControllerName = controllerName;
            model.ConfigurationRouteValues = routeValues;
            return View(model);
        }

but there is a error " A potentially dangerous Request.Path value was detected from the client (?) "

How can I slove it.

1

1 Answers

1
votes

you can not be pass any parameter to action through siteMap.cofig in NOPCommerce because if you write action name with parameter in Action attribute of siteMapNode it consider that is action name. so if want to call any action with parameter then crate a new Action for it and redirect from that.

//In Site Map 

    <siteMapNode title="Shipping rate" nopResource="Admin.Configuration.Shipping.Rate" controller="Shipping" action="SomeAction"/> 


//In Shipping Controller 


    public ActionResult SomeAction()
    {
         return RedirectToAction("ConfigureProvider", new { systemName = "Shipping.ByWeight" });
    }


    public ActionResult ConfigureProvider(string systemName)
    {

    }

In this way you can call your action.