MVC4在视图中处理会话或查询字符串不是一个好习惯

时间:2013-02-11 06:54:49

标签: asp.net-mvc-4

大家好我刚刚开始处理MVC,这就是我在cshtml页面内写的内容

@if (Request.QueryString["TechID"] != null)
{
int TechID = Convert.ToInt16(Request.QueryString["TechID"].ToString());
forumAPP.newForumDBEntities db = new forumAPP.newForumDBEntities();
var topic = from p in db.tblTechnologies where p.TechID == TechID select p.TechName;
string strText = "A forum where you can post questions regarding " + topic.FirstOrDefault().ToString(); ;
@Html.Label("Name", strText)
}

我只是想知道编写一些代码来处理会话以显示一些示例内容(例如Username或所需文本而不是写入model

0 个答案:

没有答案
相关问题