2012-02-08 60 views
1

我想现在ASP.net MVC同样动作的两个电话之间的区别:使用GET和POST由ASp.net MVC

public class VisualizzareAreaIntervento 
    { 
     public string Descrizione { get; set; } 
     public int PageNum { get; set; } 
     public int PageSize { get; set; } 
    } 

public JsonResult GetItems(VisualizzareAreaIntervento command){ 
... 
} 

如果我通过邮政称呼它,一切工作正常而在行动aprameter命令以及初始化:

var command = new VisualizzareItems(descrizione,pageNum,pageSize); 
     $.ajax({ 
      type: 'Post', 
      url: '@Url.Action("GetItems")', 
      data: JSON.stringify(command), 
      contentType: 'application/json; charset=utf-8', 
      success: success, 
      error: error, 
      dataType: 'json' 
     }); 

与得到相同的电话,让我在它与默认值的命令对象(“”,0,0)

var command = new VisualizzareItems(descrizione,pageNum,pageSize); 
      $.ajax({ 
       type: 'Get', 
       url: '@Url.Action("GetItems")', 
       data: JSON.stringify(command), 
       contentType: 'application/json; charset=utf-8', 
       success: success, 
       error: error, 
       dataType: 'json' 
      }); 

我已经看过萤火虫,并且对象发送了两次。 ASP.net MVC如何解决这个问题?

感谢您的支持,

回答