如何在MVC3 View(Razor)中编写会话?

时间:2012-09-07 08:41:05

标签: asp.net-mvc-3 views

朋友们,我怎样才能在mvc视图中获得会话值。

我需要写那样的

 @Html.ActionLink("Upload Images", "IndexBib", "Cataloging", new { Area = "Cataloging" },new {//session value for id parm//)  

先谢谢

2 个答案:

答案 0 :(得分:1)

@HttpContext.Current.Session["ID"].ToString()

答案 1 :(得分:1)

嗨,你可以这样做

@Html.ActionLink("Upload Images", "IndexBib", "Cataloging", new { Area = "Cataloging", id = (string)Session["param"]}, null)