G
Guest
Hi,
I am writing a webpage in C#. Visual Studio .NET.
the following code does not provide me with intellisence on the context,
session, and page.cache.
When I put the large if...then statment from the GetJSHyperlinksString()
function
into the private void on page load event the intellisence works fine.
I pretty sure I'm not declaring the function properly and my scope is wrong.
the function is : public static string GetJSHyperlinksString()
I also get object reference is required for nonstatic field and a property
where a class was expected errors at compile on the context, session, and
page.cache statements.
Please advise.
code is:
public class leftnav : System.Web.UI.Page
{
public const string CACHE_NAV_DATA = "NavData";
public const string SESSION_NAV_DATA = "UserSessionNavData";
protected System.Web.UI.HtmlControls.HtmlForm Form1;
private void Page_Load(object sender, System.EventArgs e)
{
RegisterLinkButtonScript();
}
public static string GetJSHyperlinksString()
{
//this function will determine the hyperlinks available to the logged
//in user by reading the database. Default hyperlinks are constructed
//for those who are not logged in.
object objsession;
string JSHyperlinksString = string.Empty;
//check to see if the hyperlinks already exist.
//this javascript code is parsed by the worker thread into an
//unmanaged client side code whenever it is retrieved by the
//page.cache.get method
if(Context.User.Identity.IsAuthenticated)
{
objsession = Session[SESSION_NAV_DATA];
}
else
{
objsession = Page.Cache[CACHE_NAV_DATA];
}
I am writing a webpage in C#. Visual Studio .NET.
the following code does not provide me with intellisence on the context,
session, and page.cache.
When I put the large if...then statment from the GetJSHyperlinksString()
function
into the private void on page load event the intellisence works fine.
I pretty sure I'm not declaring the function properly and my scope is wrong.
the function is : public static string GetJSHyperlinksString()
I also get object reference is required for nonstatic field and a property
where a class was expected errors at compile on the context, session, and
page.cache statements.
Please advise.
code is:
public class leftnav : System.Web.UI.Page
{
public const string CACHE_NAV_DATA = "NavData";
public const string SESSION_NAV_DATA = "UserSessionNavData";
protected System.Web.UI.HtmlControls.HtmlForm Form1;
private void Page_Load(object sender, System.EventArgs e)
{
RegisterLinkButtonScript();
}
public static string GetJSHyperlinksString()
{
//this function will determine the hyperlinks available to the logged
//in user by reading the database. Default hyperlinks are constructed
//for those who are not logged in.
object objsession;
string JSHyperlinksString = string.Empty;
//check to see if the hyperlinks already exist.
//this javascript code is parsed by the worker thread into an
//unmanaged client side code whenever it is retrieved by the
//page.cache.get method
if(Context.User.Identity.IsAuthenticated)
{
objsession = Session[SESSION_NAV_DATA];
}
else
{
objsession = Page.Cache[CACHE_NAV_DATA];
}