【发布时间】:2010-10-05 15:50:10
【问题描述】:
首先对不起我的英语不好,我是法国人。我会尽量让我明白:)
我想将参数从视图传递到控制器不使用使用 url。
参数是一个用户标识,我不希望有人在 url 中手动更改它。
我的代码在视图中:
<% foreach (var item in ViewData["ClientsList"] as List<SalesCoverseal_V2.Models.Customer>)
{ %>
<tr>
<td>
<%: Html.ActionLink("Editer", "ClientEdit", new { id=item.PersonId }) %>
<%: Html.ActionLink("Faire une offre", "Index", new { controller
= "Offer", id=item.PersonId }) %>
在控制器中:
public ActionResult Index(string id)
{
if (currentLoginUser != null)
{
CurrentCustomer = WebService.GetClientInfos(id);
SessionManager.CurrentCustomer = CurrentCustomer;
OfferViewModel viewmodel = new OfferViewModel();
return View(viewmodel);
}
My url :
> http://localhost:50905/Offer/Index/WS00000401
But I don't want this url, I want
> http://localhost:50905/Offer/
你能帮帮我吗?谢谢你
【问题讨论】:
标签: asp.net-mvc-2 url-routing parameter-passing