Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 WebPageContext.Current在安装VS2012后为空_Asp.net Mvc 3_Visual Studio 2012 - Fatal编程技术网

Asp.net mvc 3 WebPageContext.Current在安装VS2012后为空

Asp.net mvc 3 WebPageContext.Current在安装VS2012后为空,asp.net-mvc-3,visual-studio-2012,Asp.net Mvc 3,Visual Studio 2012,所以我决定试试Visual Studio 2012 professional。安装并打开MVC3解决方案后,我在((WebViewPage)WebPageContext.Current.Page).Html处收到空引用异常;其中WebPageContext.Current为空。糟糕的想法是:即使在签出“干净”的解决方案并用VisualStudio2010打开它之后,我仍然会得到相同的异常,而其他项目成员不会。异常发生的地方在本手册中有所介绍。代码: //变通方法-公开MVC HtmlHelper

所以我决定试试Visual Studio 2012 professional。安装并打开MVC3解决方案后,我在((WebViewPage)WebPageContext.Current.Page).Html处收到空引用异常;其中WebPageContext.Current为空。糟糕的想法是:即使在签出“干净”的解决方案并用VisualStudio2010打开它之后,我仍然会得到相同的异常,而其他项目成员不会。异常发生的地方在本手册中有所介绍。代码:

//变通方法-公开MVC HtmlHelper而不是普通帮助器
公共静态新HtmlHelper Html
{
获取{return((WebViewPage)WebPageContext.Current.Page).Html;}
} 
// Workaround - exposes the MVC HtmlHelper instead of the normal helper
public static new HtmlHelper<object> Html
{
    get { return ((WebViewPage)WebPageContext.Current.Page).Html; }
}