2012-10-03 80 views
0

我寫了sitemap.config。客戶端檢測到潛在危險的Request.Path值?

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


     </siteMapNode> 

這就是我想打電話給航運控制器功能。

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); 
     } 

,但有一個錯誤" A potentially dangerous Request.Path value was detected from the client (?) "

我怎樣才能解決售後服務它。

回答

1

您無法通過NOPCommerce中的siteMap.cofig將任何參數傳遞給action,因爲如果您在動作屬性siteMapNode中使用參數編寫動作名稱,則認爲這是動作名稱。 所以如果想要調用帶有參數的任何動作,請爲它創建一個新的Action並從中重定向。

//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) 
    { 

    } 

用這種方法你可以調用你的動作。

+0

謝謝。這是工作.. – user1348351

相關問題