MVC中很奇怪的问题
新建了一个MVC 3的项目, 在HomeController中继承BaseController
BaseController代码如下
命名里的为啥就要补全? 简写语法不报错, 但是执行的时候就报错了
我已经引用了, 如果没引用报错我认了, 但这问题真的很崩溃
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.Mvc;
6 using System.Web.UI;
7
8 using Cloud.Config;
9
10 namespace UserCenter.Controllers
11 {
12 public class HomeController : BaseController
13 {
14 public HomeController()
15 {
16 }
17
18 //
19 // GET: /Home/
20
21 public ActionResult Index()
22 {
23 return View();
24 }
25
26 }
27 }BaseController代码如下
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using Cloud.Config;
namespace UserCenter.Controllers
{
/// <summary>
/// 基础
/// </summary>
public class BaseController : Controller
{
public BaseController()
{
if(Cookie("login") == null)
{
// 这地方报错, 未将对象引用设置到对象的实例。
Response.Redirect(Url.Action("Login", "Account"));
// 这地方不报错
System.Web.HttpContext.Current.Response.Redirect(Url.Action("Login", "Account"));
}
}
}
}命名里的为啥就要补全? 简写语法不报错, 但是执行的时候就报错了
我已经引用了, 如果没引用报错我认了, 但这问题真的很崩溃
...全文
相关推荐
Android ListView列表控件的介绍和性能优化
主要介绍了Android ListView列表控件的介绍和性能优化,需要的朋友可以参考下
这种贪吃蛇好奇怪(根据vc的MVC编写)
内容索引:VC/C++源码,游戏编程,贪吃蛇 有点奇怪的贪吃蛇游戏,看上去有些逗,根据vc的MVC编写,源码编译无错,希望大家喜欢。
java中常见的异常原因
最近学习MVC,springcloud时,碰到了各式各样的bug,bug玄学博大精深,源远流长,为传承猿式玄学,苦寻葵花宝典,终得真经,特与众猴共享~~~~~ 。最好使用struts console工具检查一下。 另外,load-on-startup必须在web.xml中声明,这要么是一个空标记,要么指定一个数值,这个数值用来表servlet运行的优先级,数值越大优先级越低。 还有一个和使用load-on-startup有关的是使用Struts预编译JSP文件时也可能导致这个异常。- 异常 java.lang.NullPointerException at org.apache.struts.
Agile Web Development
An introduction of using Rails for web development and it's recommended by company developing Rails
nobsjs.github.io
nobsjs.github.io


