小编blu*_*lue的帖子

命名空间"System"中不存在类型或命名空间名称"Windows"

我正在尝试编写弹出消息框,用于显示在C#.net中成功记录插入的消息

错误:

名称空间"System"中不存在类型或命名空间名称"Windows"(您是否缺少程序集引用?)

代码:

 global::System.Windows.Forms.MessageBox.Show("Test");
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc-3

8
推荐指数
3
解决办法
4万
查看次数

"使用Mvc.Mailer;"时出错

我正在尝试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)

mvcmailer asp.net-mvc-3

3
推荐指数
1
解决办法
1729
查看次数

非静态字段,方法或属性'System.Web.Mvc.Controller.HttpContext.get'需要对象引用

我在我的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)

c# asp.net-mvc-3

3
推荐指数
1
解决办法
3万
查看次数

为什么MVC actionlink无法正确呈现?

我传递了这个:

<%: 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)

html asp.net-mvc html-helper html.actionlink

1
推荐指数
1
解决办法
990
查看次数