0

我正在尝试将我当前的 url 传递给我的 actionresult 但 returnUrl 总是出现 null

    @Html.ActionLink("Create Student", "Create", "StudentCenter", new{ returnUrl = Request.RawUrl}, new { @class = "button" })

这是控制器

public ActionResult Create(string returnUrl)
    {
        HttpCookie cookie = new HttpCookie("redirectCookie",returnUrl);
        ViewBag.Sex = new SelectList(Enum.GetNames(typeof(SchoolCup.Domain.Sex)));
        return View();
    }
4

1 回答 1

0

我认为你必须像这样使用

@Html.ActionLink("Create Student", "Create", "StudentCenter", new{ returnUrl = Request.RawUrl.ToString()}, new { @class = "button" })

请尝试向我发送反馈

您期望的字符串是这样的“studentCenter/create”吗?

于 2013-05-22T01:29:02.260 回答