J
Johan Riis Johansen
Hi Folks!
A few tips or pointers on this one would be appriciated.
Presently I'm working on a webproject, and I've decided to
create a class that acts as template for all pages on the
site. What all the pages do is inheirit from
MyTemplatePage instead of System.Web.UI.Page. That works
fine and everything. My problem actually stems from the
fact that the same class has to be used for dictating the
layout of Classic ASP pages (instead of SSI). I have
converted the class(es) into a Class Library and then
registered the resulting assembly in the GAC (Global
Assembly Cache) on the server.
This also works fine, EXCEPT I can't access the context of
the caller (aspx-page). I'm not looking for a solution
where I can access/manipulate with the session object of
classic asp-pages, but I would like to be able to handle
the Application, Session, Querystring object of the
aspx.page in the assembly.
Is that at all possible? And how is it done?
I've tried the abvious, just adding a reference to the
system.web assembly
from the project, and then just trying this:
<Code>
public class MyTempPage : System.Web.UI.Page
{
private Boolean p_ContextGetEnabled;
public MyTempPage()
{
try
{
if (Application["objMenu"] == null)
{
MyMenuClass objMenu = new MyMenuClass();
Application.Add("objMenu", objMenu);
if (((MyMenuClass)Application
["objMenu"]).TestFunc() //Returns true when called
p_ContextGetEnabled = true;
else
p_ContextGetEnabled = false;
}
}
catch(Exception excep)
{
p_ContextGetEnabled = false;
}
}
public Boolean ContextGetEnabled
{
get {return p_ContextGetEnabled;}
}
....
....
.... //And so it continues.
</Code>
The ContextGetEnabled function ALWAYS returns false /
Any help would be very much appricated.
Thanks in advance.
JR Johansen
A few tips or pointers on this one would be appriciated.
Presently I'm working on a webproject, and I've decided to
create a class that acts as template for all pages on the
site. What all the pages do is inheirit from
MyTemplatePage instead of System.Web.UI.Page. That works
fine and everything. My problem actually stems from the
fact that the same class has to be used for dictating the
layout of Classic ASP pages (instead of SSI). I have
converted the class(es) into a Class Library and then
registered the resulting assembly in the GAC (Global
Assembly Cache) on the server.
This also works fine, EXCEPT I can't access the context of
the caller (aspx-page). I'm not looking for a solution
where I can access/manipulate with the session object of
classic asp-pages, but I would like to be able to handle
the Application, Session, Querystring object of the
aspx.page in the assembly.
Is that at all possible? And how is it done?
I've tried the abvious, just adding a reference to the
system.web assembly
from the project, and then just trying this:
<Code>
public class MyTempPage : System.Web.UI.Page
{
private Boolean p_ContextGetEnabled;
public MyTempPage()
{
try
{
if (Application["objMenu"] == null)
{
MyMenuClass objMenu = new MyMenuClass();
Application.Add("objMenu", objMenu);
if (((MyMenuClass)Application
["objMenu"]).TestFunc() //Returns true when called
p_ContextGetEnabled = true;
else
p_ContextGetEnabled = false;
}
}
catch(Exception excep)
{
p_ContextGetEnabled = false;
}
}
public Boolean ContextGetEnabled
{
get {return p_ContextGetEnabled;}
}
....
....
.... //And so it continues.
</Code>
The ContextGetEnabled function ALWAYS returns false /
Any help would be very much appricated.
Thanks in advance.
JR Johansen