声明并启动以下流程后:
System.Diagnostics.Process _p = new System.Diagnostics.Process();
.....
.....
....
_p.Start();
Run Code Online (Sandbox Code Playgroud)
现在有两种可能性:输出或错误.
如果发生错误,是否有Process
类的属性可以通过它来确定是否发生错误?
我正在重定向标准输出,我不想在MSDN中警告重定向标准错误.我也不想使用:BeginOutputReadLine();
还有其他选择吗?
谢谢.
我需要在MVC 4中实现我自己的自定义错误页面.基本上,当用户尝试查看Details
任何不存在productID的产品时,我想要这个自定义错误页面.
我创建了自己的自定义错误页面 NotFound.aspx
此页面的内容包括:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Simple.Master"
Inherits="System.Web.Mvc.ViewPage<System.Web.Mvc.HandleErrorInfo>" %>
<asp:Content ID="errorTitle" ContentPlaceHolderID="TitleContent" runat="server">
Error
</asp:Content>
<asp:Content ID="errorContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>
Sorry, you requested a product that doesn't exist. Make sure you
requested a valid ProductID
</h2>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)
然后将HandleError
过滤器应用到我的ActionMethod:Details
as:
[HandleError(View="NotFound")]
public ActionResult Details(int id) {...
Run Code Online (Sandbox Code Playgroud)
问题是,始终默认视图: Views/Shared/Error.aspx
正在调用,而不是新的自定义错误页面.有什么想法吗 ?
参考这个问题为什么下面的代码总是返回true?[c#语言]
String a= "hello";
String b= "hello";
if(a==b)
Console.WriteLine("Is it really reference type?");
Run Code Online (Sandbox Code Playgroud)
只想要解释为什么在这里它们表现为值类型而不是引用类型.是否有关于此OR的MSDN文档或者我应该记住这个异常或者这是完全合乎逻辑的但是我没有得到它?
详细解释赞赏.