我正在尝试编写弹出消息框,用于显示在C#.net中成功记录插入的消息
错误:
名称空间"System"中不存在类型或命名空间名称"Windows"(您是否缺少程序集引用?)
代码:
global::System.Windows.Forms.MessageBox.Show("Test");
Run Code Online (Sandbox Code Playgroud) 我正在尝试MvcMailer用于在我的MVC3应用程序中发送电子邮件.
我已经成功安装了包MvcMailer.
使用的参考无法安装MvcMailer并按照步骤操作
但是在使用它时会出错.
using Mvc.Mailer;
The type or namespace name 'MailerBase' could not be found (are you missing a using directive or an assembly reference?)
我在下面的代码中提到错误作为评论.
using Mvc.Mailer; //The type or namespace name 'Mvc' could not be found (are you missing a using directive or an assembly reference?)
namespace MvcApplicationMvcMailer.Mailers
{
public class UserMailer : MailerBase, IUserMailer //The type or namespace name 'MailerBase' could not be found (are you missing a using directive …Run Code Online (Sandbox Code Playgroud) 我在我的MVC3应用程序中收到此错误.请帮忙...
错误:
An object reference is required for the non-static field, method, or property 'System.Web.Mvc.Controller.HttpContext.get'
在线:
string desigId = HttpContext.Current.Session["Desig_Id"].ToString();
类中的代码及其方法:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Helpers;
using System.Net.Mail;
using System.Net;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading.Tasks;
namespace ApricaCRMEvent.Controllers
{
public class NotificationController : Controller
{
//to send email notification
[Authorize]
public static string SendEmailNotification(int crmId, string username, string action)
{
string desigId = HttpContext.Current.Session["Desig_Id"].ToString();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我传递了这个:
<%: Html.ActionLink("Edit", "EditCRMRequest", "CRM", new { Id = item.Id })%>
Run Code Online (Sandbox Code Playgroud)
我进入浏览器:
http://something.com/CRM/EditCRMRequest?Length=3
Run Code Online (Sandbox Code Playgroud)
与错误代码:
参数字典包含非可空类型'System.Int32'的参数'Id'的空条目,用于'ApricaCRMEvent.Controllers.CRM.CRMController'中的方法'System.Web.Mvc.ActionResult EditCRMRequest(Int32)'.可选参数必须是引用类型,可空类型,或者声明为可选参数.参数名称:参数
如果我在浏览器中明确地写这个,它工作正常:
http://something.com/CRM/EditCRMRequest?Id=3
Run Code Online (Sandbox Code Playgroud)