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