方法一:通过Request.Form [HttpPost] public ActionResult Test() { string id=Request.Form["id"]; return View(); }方法二:通过映射到FormCollection...
分类:
Web程序 时间:
2015-04-02 14:48:05
阅读次数:
125
背景介绍,这篇文章是的内容里,出现的back是 EF 对象(大家都懂!^0^) 这里解释下,ActionResult 大家都懂,返回给视图了。而传的参数:int? page,经过楼主的思考,还是用了((*^__^*) 第一次用,之前只知道有这个东西)但是这里遇见个问题,请大家指教了:当使用三元表达....
分类:
Web程序 时间:
2015-04-01 19:30:02
阅读次数:
135
[IdentityAuthorize] public ActionResult Index() { return View("~/Views/Index.cshtml"); } [AttributeUsage(AttributeTargets.Method | AttributeTarget...
分类:
其他好文 时间:
2015-04-01 13:07:01
阅读次数:
100
EF操作数据库中的数据非常方便,例如查询:OumindBlogEntities db = new OumindBlogEntities(); public ActionResult Index() { //db.BlogArticles.Where(...
分类:
Web程序 时间:
2015-04-01 11:08:05
阅读次数:
232
在做后台管理时用户登录后就需要验证哪些权限了,没有登录的就直接退出到登录页面。系统有自带的权限[Authorize],可用于几个地方:1、将属性[Authorize]置于相关的action上方,验证当前[Authorize] public ActionResult Index() { ret...
分类:
Web程序 时间:
2015-03-20 12:22:29
阅读次数:
278
原理,在一个Action里面return 另一个Action出去。 public class HomeController : Controller { // GET: Home public ActionResult Index(int? id) {...
分类:
Web程序 时间:
2015-03-19 19:50:14
阅读次数:
248
public ActionResult MyComment(string id, int page = 1) { string userid = EndUserLoginManage.Instance.loginUserID; IC...
分类:
Web程序 时间:
2015-03-19 11:28:20
阅读次数:
169
验证码 /// ///负责生成验证码 /// /// public ActionResult Vcode() { //1.产生一个随机数 string rVcode = GetVc...
分类:
其他好文 时间:
2015-03-19 06:11:21
阅读次数:
116
前言MVC我是11开始使用的,当时还是在上地软件园一小型互联网公司,当时是MVC2.0+Linq to sql。后来接着学习MVC3,MVC3的出现确实让我有种眼前一亮的感觉,期间我不断的写各种demo,一直到现在再看MVC时就有点生疏了,有一年多没用了,好多知识很细节都遗忘了。看到同事的代码前几天...
分类:
Web程序 时间:
2015-03-18 11:58:51
阅读次数:
124
两步一.在之前加上 二.控制器方法之前加[ValidateInput(false)] [ValidateInput(false)]public ActionResult AddInfo(){}
分类:
其他好文 时间:
2015-03-17 23:08:44
阅读次数:
125