How to access GetGlobalResourceObject()
I'm new to c#. I have this class开发者_如何学运维...
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public class clsErrorMessages
{
string _sErrors;
public clsErrorMessages(string sErrorTextFileName)
{
_sErrors = (String)GetGlobalResourceObject("resource","FriendlyErrors.txt");
}
}
The compiler says the name 'GetGlobalResourceObject' does not exist in the current context
Do I need to include another using
?
The GetGlobalResourceObject() method is a static member of the HttpContext class. You need to qualify it as such:
_sErrors = (string) HttpContext.GetGlobalResourceObject("resource",
"FriendlyErrors.txt");
精彩评论