我在我的MVC3應用程序中收到此錯誤。請幫助...非靜態字段,方法或屬性'System.Web.Mvc.Controller.HttpContext.get'需要對象引用
錯誤:
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();
}
}
}
這將是很好,如果你鏈接到英文版的文件,而不是德文。 – paqogomez