2012-10-03 3 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 (?) "

내가 그것을 어떻게 풀기가 할 수있는 오류가 있습니다. 당신이 siteMapNode의 Action 속성에서 매개 변수를 사용하여 작업 이름을 작성하는 경우는 그 액션 이름 고려해야하기 때문에

답변

1

당신은 NOPCommerce에 siteMap.cofig을 통해 행동에 어떤 매개 변수를 전달 할 수 없습니다. 매개 변수가있는 작업을 호출하려면 새 작업을 작성하고 해당 작업에서 리디렉션하십시오.

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

관련 문제